On Thu, Nov 25, 2004 at 04:35:35PM +1300, Volker Kuhlmann wrote:
I'm interested in the exit code of a grep -f patternfile run over all
the headers. However, I don't want the original msg changed. The first
two things which spring to mind
:0
* ? grep -f
and
:0 fhw
| grep -f
don't work because the first doesn't get to see the headers, and the
second removes all headers not matching something in patternfile.
Volker,
I think you've come to a conclusion about the first one that is not
entirely correct. The headers are absolutely piped through a condition
with a test operator ("?").
Here is a recipe I put in my test harness:
:0
* ? grep -qs -w - -f foo
{ MYEXIT = $? }
Here is what's in the file "foo":
12:03am [~/Mail] 416[1]> cat foo
Dallman
Outlook
Let's try it first from the shell prompt. Note that "headers" is an alias
I have that spits out the headers:
12:05am [~/Mail] 419[0]> headers SPAMPLE | grep -f foo
X-Mailer: Microsoft Outlook, Build 10.0.2616
Let's confirm that with syntax closer to the recipe's:
12:05am [~/Mail] 420[0]> headers SPAMPLE | grep -qs -w - -f foo && echo yup
|| echo nope
yup
And now let's try the recipe from my test harness:
12:08am [~/Mail] 424[0]> harness SPAMPLE | tail | head -4
procmail: Executing "grep,-qs,-w,-,-f,foo"
procmail: Match on "grep -qs -w - -f foo"
procmail: Assigning "MYEXIT=0"
So it works fine.
Hope that helps!
--
dman
____________________________________________________________
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