procmail
[Top] [All Lists]

Re: If / Else in Procmail

2005-03-28 13:13:25
At 16:29 2005-03-28 -0300, Marcio R A Garcia wrote:
   :0a
    {
        action
        action
        action
    }
    :0e
    {
          action
          action
          action
    }
}

This is correct ???

E flag, but not WITHIN the braces of the condition. What you have above says BOTH recipes within the conditions must match the outermost condition. Your use of 'e' (not UPPERCASE), means that the preceeding recipe must have FAILED - this is a useful way to make use of an external application for performing some check, though more typically, people invoke the command as part of the conditions. The 'a' flag is nonsensical in your application, as there is no preceeding recipe at the same block nesting level. It's an "and" (assuming that the prior recipe didn't deliver and stop processing).

:0
* condition
action

:0E
action


note that if the action in the first recipe is a delivery, execution of the procmailrc will end there, and you'd never even reach the second recipe, so in many typical cases, the 'E' really isn't necessary. If you were running a 'c' on the first recipe, or if it was a filter, the 'E' becomes necessary.


Also, in your pseudocode, you show multiple action lines under each sub-recipe. Procmail supports exactly ONE action per recipe. If you have multiple commands to invoke, you need to invoke them as per chained commands in your shell (i.e. separate them with semicolons).


You might want to take a few moments and read the manpages. 'man procmailrc' in particular, which explains all the recipe flags.

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.


____________________________________________________________
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