procmail
[Top] [All Lists]

Re: Suppressing Unwanted Error Message

1997-07-18 19:51:00
Paul O Bartlett <pobart(_at_)access(_dot_)digex(_dot_)net> writes:
   procmail 3.10 under SunOS 4.1.4.  Normally running with 
VERBOSE=off and LOGABSTRACT=no after recipes debugged.

   I have the following fragment in a recipe:

:0 wc
| egrep -is $WHOFROM $USERLIST

where $WHOFROM contains a string to be looked up in the file 
pointed to by $USERLIST.  All I want to know is whether egrep
did or did not find $WHOFROM in $USERLIST.  Yes or no determines 
the subsequent action, so I don't care about any actual messages 
from egrep.

   However, when I tested with a value in $WHOFROM which deliberately
would not be in $USERLIST, procmail made the following entry in the 
log, despite the log settings above:

procmail: Program failure (1) of "egrep"

I already have logic to take care of the case in which the egrep 
"fails," so I don't need this message cluttering up the log.  
Unless I missed it, I did not see anything in the docs to suppress 
this superfluous "error" message.  Hints?

Since you want to use it as a condition, you could make it one:

        :0
        * ? egrep -is $WHOFROM $USERLIST
        * whatever conditions were on the following recipe(s)
        ...etc

Yes, program conditions have the email message on their stdin, and as
long as you don't have VERBOSE turned on, procmail won't log their
failure, it being expected.

Note that if you use the 'e' flag on the following recipe (as opposed to
the 'a' flag) to determine whether the egrep succeeded or failed, then
you'll need to negate the program condition by putting a '!' in from of
the '?'.

Philip Guenther

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