procmail
[Top] [All Lists]

Re: Suppressing Unwanted Error Message

1997-07-19 10:33:00
    Well, if nothing else, I am learning a lot 
more about procmail, and I suppose that is a 
Certified Good Thing. :)

On Sat, 19 Jul 1997, David W. Tamkin wrote:

Paul Bartlett replied to Philip Guenther's advice,
| [etc.]

That's it, pretty much.  Then Paul gave more details on the code in question:

|     # check whether $WHOFROM value is in # $USERLIST file
|     :0 wc
|     | egrep -is $WHOFROM $USERLIST
| 
|     # subrecipe to execute if egrep _does_ find a match
|     :0 a
|     { big nesting block }
| 
|     # subrecipe to execute if egrep _does_not_ find a match
|     :0 E
|     { another big nesting block }

    Those "subrecipes," of course, could have been indented to 
make the logic a little more obvious visually.

You can write it like this, and procmail will not comment on a bad exit
code from egrep (unless you have VERBOSE on, in which case procmail will
log "No match" for the egrep condition if it exits with failure):

       :0
       * ? egrep -is "$WHOFROM" $USERLIST
       { first big nesting block }
       :0E
       { second big nesting block }

    I discovered the hard way (plowing through a long log) that 
I failed to have even a "dummy" action routine on:

# check whether $WHOFROM value is in # $USERLIST file
:0 wc
| egrep -is $WHOFROM $USERLIST

This caused unwanted behavior.  So I made it:

# check whether $WHOFROM value is in # $USERLIST file
:0 wc
| egrep -is $WHOFROM $USERLIST
{ }

Then this, I dicovered, was causing procmail to fork when I sent a test
message to myself, as a member of the group, so that I was getting
duplicate messages sent to myself (being the only group member for this
test).  The 'c' flag was apparently the culprit, so when I removed it,
I only got a single copy.  So far everything looks good, so I have a
couple of test volunteers who may put up with me a while longer. :)
Thanks again, folks.

P.S.  I understand the structuring of the code as David has given it in
his response, but to me the logic is clearer if I keep each big nesting
block in its own subrecipe (should have indented, as I said).

Regards,
Paul                             <pobart(_at_)access(_dot_)digex(_dot_)net>
----------------------------------------------------------
Paul O. Bartlett, P.O. Box 857, Vienna, VA 22183-0857, USA
Finger, keyserver, or WWW for PGP 2.6.2 public key
Home Page:  http://www.access.digex.net/~pobart

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