procmail
[Top] [All Lists]

Re: save to list dir and conditionally to $DEFAULT

2012-11-13 12:19:24
Eric Smith squawked out on Monday 12-Nov-2012@01:05:14
I want all list mail to be saved to the appropriate list folder
and if they match a pattern in a file, also save to $DEFAULT.
This is what I am trying, multiple stanzas like these;


:0:
* ^x-mailing-list:([^ ]*\/\<.*)
{
:0c
$LISTDIR/`echo $MATCH|sed -e 's/[@\.>].*//g' -e 's/.*[ <]//' -e
's/.*://'`
:0
* ? egrep -if  /home/eric/serialised_subjects
$DEFAULT
}

:0:
* ^x-list:([^ ]*\/\<.*)
{
:0c
$LISTDIR/`echo $MATCH|sed -e 's/[@\.>].*//g' -e 's/.*[ <]//' -e
's/.*://'`
:0
* ? egrep -if  /home/eric/serialised_subjects
$DEFAULT
}

The behaviour without the `c' in :0c is that the mail is only saved in
the list dir. And with the `c' in :0c, the mail is saved 
MULTIPLE times in list dirs (as it matches more than one list
regex condition) and one in the $DEFAULT.

What would be the correct implementation?

If your shell escape is producing multiple matches, then you probably should be 
doing that separately, and then checking the output.


-- 
Qui me amat, amat et canem meam



____________________________________________________________
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