I'm still trying to set up some filtering in a user's .qmail file, using 
822field. (Yeah, I said 822header the last time. I've learned some since then.)

Anyway, I'm trying to test it out by having it throw away any email whose 
subject contains "delete" with a case-insensitive match. right now, I have:

/var/qmail/alias/.qmail-testing:
|if [ "/usr/local/bin/822field Subject | grep -i Delete" ]; then exit 99; fi
&kai

Unfortunately, no emails get deleted; they all come through to the kai 
account. Tests on the command line, using already-delivered messages such as:

if [ "cat /home/kai/Maildir/cur/957998125.12037.set.logx.com:2, | \
822field Subject | grep -i delete" ]; then echo "Foo"; \
else echo "Bar"; fi

always echo "Foo", never "Bar". (I've been swapping between a couple of 
filenames, one of which is a message with "This Should Be Deleted" as the 
subject, the other of which has "This Should Go Through" as the subject.) 
Apparently, grep is returning 0 whether it finds any matches or not, 
contrary to its man page -- or more likely, the shell test operator is 
returning 0 because the operation completed successfully.

I realize this is turning into much more of a shell programming question 
than a qmail question, but since I know there's gotta be at least one 
person here who has experience with using 822field in a .qmail file, can 
anyone clue me in on how to properly get the thing to exit 99 when I need 
it to?

Thanks in advance.

-----------------------------------------------------------------
                              Kai MacTane
                          System Administrator
                       Online Partners.com, Inc.
-----------------------------------------------------------------
 From the Jargon File: (v4.0.0, 25 Jul 1996)

finger trouble /n./

Mistyping, typos, or generalized keyboard incompetence (this is
surprisingly common among hackers, given the amount of time they
spend at keyboards). "I keep putting colons at the end of statements
instead of semicolons", "Finger trouble again, eh?".

Reply via email to