procmail
[Top] [All Lists]

Re: Filtering on critera not based on message?

2001-09-22 11:10:19
Kelsey Cummings <kgc(_at_)sonic(_dot_)net> writes:
On Fri, Sep 21, 2001 at 04:20:54PM -0700, Professional Software Engineering wr
ote:
At 15:31 2001-09-21 -0700, Kelsey Cummings wrote:

Try searching the archives for a thread titled "Checking the exitcode of a 
program" (try a specific search for "exitstatus", rather than exitcode, 
since the latter is a special procmail variable).

I'll look again, what I came up with before didn't directly
answer my question.

Here's a hint: procmail follows the (Bourne) shell's lead as to where
it saves the exitstatus of the last program executed.


...
It just seemed wasteful to attempt to feed the message into
the pipe.  I thought there might be some other way to build
conditions based on return values of external programs or
set environment variables.

Um, there is.  To quote the procmailrc(5) manpage:

       There are some special conditions you can use that are not
       straight regular expressions.  To select them, the  condi-
       tion must start with:
...
       variablename ??
            Match the remainder of  this  condition  against  the
            value of this environment variable (which cannot be a
            pseudo variable).  ...

If you want to make the check based on the exitcode of an external
program, you merely need to set a 'real' variable to the program's
exitstatus and then match against that variable.


in psuedo code:

: [if $NOFILTER]
$MAIL
else
some procmail rules...

Do you want check whether NOFILTER is set at all, set to a non-empty
value, or something else?  What's the "$MAIL" supposed to represent?


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>