procmail
[Top] [All Lists]

Re: variables in conditions?

1996-06-02 12:04:50
Kevin at Paranoia <kevintx(_at_)ministry(_dot_)paranoia(_dot_)com> writes:
Can I use variables in the conditions of a procmail recipe?  If so, I must
not be escaping it right or am otherwise just messing it up.. can you send
me an example of some variable usage in a recipe?

Variables are only expanded inside conditions if the condition is prefixed
with a dollar sign, ala:

MYADDR = guenther(_at_)gac(_dot_)edu

:0
* $ ! ^X-Loop: $\MYADDR
*   ! ^FROM_DAEMON
... etc


You may want to think hard about whether the variable should be expanded
with the regexp characters escaped via the $\foo form, as show above.

You should also be careful about the non-variable stuff in the '$' flagged
condition: the following isn't 'maximally' correct:

:0
* $ ! ^X-Loop: $LOGNAME(_at_)gac\(_dot_)edu$
... etc


1) the '\' on the "\." disappear during the '$' expansion.  It should be
        written as "\\."
2) the '$' to match end-o'-line I _believe_ also disappears (though maybe
        not).  To be safe it should also be escaped.

Thus:

:0
* $ ! ^X-Loop: $LOGNAME(_at_)gac\\(_dot_)edu\$
... etc


Does that make sense?

Philip Guenther

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