procmail
[Top] [All Lists]

null actions [was: Re: Matching blank lines]

1999-10-20 19:15:52
Philip Guenther wrote:

Alastair Irvine <alastair(_at_)atri(_dot_)curtin(_dot_)edu(_dot_)au> writes:
When I was using procmail v3.03, the following recipe matched the first
line, a blank line and the second line (at the start of the message):

 :AB
 * ^^Your "cron" job^()^/admin/lib/backup 0 mammoth

(It took me a while to figure out that I needed the () in there,
otherwise the ^^ token was recognised rather than two line-starts.)

Under procmail v3.13, it won't match the blank line.  I've tried the
above regexp, ...job^^/adm and ...job$^$^/adm... but none of them match.
Any ideas?

Hmm, all four of the following worked for me:
[snip Philip's examples]

It turns out that the problem was *not* with the above recipe; it was
with the one preceeding it.

As everyone knows, the default behaviour is for procmail to grep the
headers for the conditions.  What I wanted to do was check the headers
for a regexp and if that matched, check the body for a different one.  I
had done it by having a :0 recipe with no action (which previous
versions of procmail supported) followed by a :A recipe (above) which
would only execute if the "null" one before it succeeded.

Of course, it was trivial to re-write as :0 ... { ... :B ... } , but the
point was, the above "used" to work.  (You can use "|cat" as the action,
but that's messy.)  It was also a bit neater when used to make several
:A recipes execute if a given common condition is true.  One thing you
can't do easily with {} is have a bunch of recipes chained off a common
"null" recipe, which each depend on the previous chained recipe as well.
(with :a).

-- 
______________________________________________________________________
Alastair Irvine     Room 314.138, Australian Telecommunications .-_|\
System Administrator              Research Institute  (ATRI)   /     \
telephone:  +61 8 9266 3509       Curtin Uni of Technology     P_.-._/
e-mail: alastair(_at_)atri(_dot_)curtin(_dot_)edu(_dot_)au       Bentley WA, 
6102.         o
______________________________________________________________________

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