procmail
[Top] [All Lists]

Re: passing variables from shell to procmail

2005-10-17 17:13:51
Troy Piggins:
Ruud H.G. van Tol:
Troy Piggins:

I need to pass a variable from within a bash script to procmail, but
can't seem to get it to work.  The variable value is always null.
[...]
  procmail example.procmailrc < $MESSAGE_NO
  mv $MESSAGE_NO.new $MESSAGE_NO

   procmail -m example.procmailrc < $MESSAGE_NO > $MESSAGE_NO.new

and use a "DEFAULT=|" in the first lines of your rc, to make procmail
deliver to stdout.

Alternatively, see man procmail, look for "parameter=value".

That's it!  Thanks mate!

Also consider

  Do once: mkdir safe

  for i in `ls -d`; do
    [ -f "$i.new" ] && mv "$i.new" safe/"$i.new_`date %F_%T`"
    procmail -m   DEFAULT="$i.new" example.procmailrc < "$i"
    [ -f "$i.new" ] && mv "$i.new" "$i"
  done


and shrink the example.procmailrc to just:

  :0 fw
  | spamc

  :0
  * ^X-Spam-Level: RR
  /dev/null


I assume that you will be doing more, since this does little more than
'touch' the non-spammish messages.

-- 
Affijn, Ruud

"Gewoon is een tijger."


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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