procmail
[Top] [All Lists]

Re: if-then

2001-08-16 01:25:14
Luka Kladaric <lkladar(_at_)komoseva(_dot_)globalnet(_dot_)hr> writes:
I would like to load a variable from a file in the beggining of my
.procmailrc and then act in several rules depending on the contents of the
variable. All I really need is for it to either be 'true' or 'false' (I'd
rather have it as 'yes' and 'no', but true/false will do just fine). Then
I'd have a rule like this:

:0
* condition
* condition
{
      if variable=YES
              EXITCODE=67
      endif

      :0
      /dev/null
}

Could someone tell me the syntax for the if-block? I'm pretty sure everybody
understands what I want here... If the variable is set to yes, all the rules
that have EXITCODE=xx will bounce mail, if it isn't set to yes, they won't.

To quote the procmailrc(5) manpage:

       variablename ??
            Match the remainder of  this  condition  against  the
            value of this environment variable (which cannot be a
            pseudo variable).  A special case is if  variablename
            is equal to `B', `H', `HB' or `BH'; this merely over-
            rides the default header/body search area defined  by
            the initial flags on this recipe.

So:
        :0
        * condition
        * condition
        {
                # If the first character of the variable is 'y' or 't'
                # (or 'Y' or 'T'), then set EXITCODE
                :0
                * variable ?? ^^[yt]
                {
                        EXITCODE = 67
                }

                :0
                /dev/null
        }


Philip Guenther
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>
  • if-then, Luka Kladaric
    • Re: if-then, Philip Guenther <=