procmail
[Top] [All Lists]

Re: variables

2002-10-09 18:56:37
Tom Allison <tallison(_at_)tacocat(_dot_)net> writes:
Is there some way that I can do something that looks like this:

| /usr/bin/foo  #This is a filter that returns an exit code
EXITCODE=$?

And then, based on the exit code, either send the email to the 
default delivery point or to an alternate (like /dev/null).

You're pretty close:

        # Feed a copy of the message to 'foo'.  Failure of the program
        # isn't really an error, so use 'W' to suppress the "Program
        # failure" message while still capturing the exit status in $?
        :0 Wc
        | foo

        # save the status for testing.  Do *NOT* use EXITCODE as that
        # has special meaning to procmail.
        status = $?

        # test the status
        :0
        * status ?? ^^0^^
        action-on-success

        :0 E
        * status ?? ^^1^^
        action-on-status=1

        :0 E
        action-on-other-failure


Philip Guenther
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>