Nathan Willis <nathan(_at_)nor(_dot_)com(_dot_)au> writes:
Sorry to all who found it hard to understand me..
I am basically asking:
How do I do *in procmail recipes* the same as:
"for i in `cat filename`"
would do in a shell script.
and then use the i's/variables to set the condition.
There is no direct way to iterate in procmail. That said, there may be
ways to do what you want to do anyway. For example, if you have a file
that contains regexps, one per line, and you want to verify that at least
on matches, then you can either call fgrep to do the matching, or if the
number of regexps isn't too large, slurp them into procmail as one big
regexp to match on.
On the other hand, if you have some actions that you want to execute
repeatedly, then you can use INCLUDERC to start a sub-.procmailrc,
which depending on conditions can INCLUDERC itself. However since
procmail is not "properly tail-recursive" about its expansion of
INCLUDERC (that would require more lookahead than procmail can do), you
should avoid looping "hundreds of times" with this, but a dozen would
It comes down to what you're trying to do. Can you describe in small
English words what you want procmail to do?
When processing messages addressed to "gargleblat",
it should compare the subject against each of the
regexps in the file "list_of_okay_subjects". If a
match is made, then everything after the match should
be saved into the variable "RESToLINE", and a recipe
block should be entered in which I can do other things.
If no match is made, keep processing the .procmail as
if the subject hadn't contained "gargleblat" to start
Is that close? If so, can you refine it to what you want? If not,
can you write your own description in that style?