procmail
[Top] [All Lists]

Re: Is there a way

2004-07-20 12:56:37
Google Kreme wrote:

On Tue, 20 Jul 2004 12:58:17 -0500, David W. Tamkin
> <dattier(_at_)panix(_dot_)com> wrote:

  TRAP='sed -n "/^$/{h;s#^#Folder: $LASTFOLDER#;p;g;p;q;};p"'

Though that was (slightly) new text in my post, I did not come up with it; rather it was my minor modification of Michael Wise's sed code, so whatever it does or doesn't do ...

This appears to dump the entire header of the message into the
LOGFILE, at least when I stuck the code in and ran a couple of
messages at it.

is up to Michael, not to me, to explain (or to decline explaining).

This was original in my post:

 LOGABSTRACT=off
 TRAP='formail -l "$LASTFOLDER"'

and Kreme asked,

can you have multiple TRAPs?

You can change the value of TRAP as many times as want, but you can't have two or more in effect at the same time.

Do they execute in the order they were declared?

Only the last one executs; any others are long forgotten. When you reassign a variable, you replace the old value. Each TRAP= assignment supersedes the previous one, and only the latest one is valid when procmail exits.

If you want the trap to perform two or more commands, you need to assign

 TRAP=`command1 ; command2`

and that, of course, will need a shell.  I'm not rightly sure what

 TRAP='command1
 command2'

will do.  In my quick tests, command1 is executed and command2 is ignored.



____________________________________________________________
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>