procmail
[Top] [All Lists]

Re: Simple Bozo-Filter Example? (fwd)

1997-02-13 05:08:53
On Wed, 12 Feb 1997 14:53:38 -0800, 
dave(_at_)magic(_dot_)geol(_dot_)ucsb(_dot_)edu (Dave
Robbins) wrote:
to others.  One undergrad, however, created the recipe *without*
adding anything to the killfile (email.killfile, in this case).
This somehow matched all mail coming to the undergrad.

Yes. For comparison, try egrep '' somefile. 

Just add a check for whether the killfile actually exists, as a
precaution. 

   FROM=`formail -rzxTo:`
   EGREP=/usr/local/bin/egrep
   :0
   * ? echo "$FROM" | $EGREP -i -f $HOME/email.killfile
   {

Add a couple of things around the :0, like so:

KILLFILE=$HOME/email.killfile
:0
* ? test -r $KILLFILE -a -s $KILLFILE
* ? echo "$FROM" | $EGREP -i -f $KILLFILE
{
 # etc
  :
  :

Hope your test(1) is in your path and understands these funny
switches. (I just tried this quickly with Bash and GNU test but they
are of course not the most plain-jane versions around.)

Hope this helps,

/* era */

-- 
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r.  <http://www.iki.fi/~era/>
 * Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>