procmail
[Top] [All Lists]

Re: Variable checking routine...

1997-12-02 03:51:36
On Mon, 1 Dec 1997, Catherine Hampton wrote:

I want to write a recipe which checks to see if a variable is set, and if
it isn't, sets it to a default value.  Will this recipe work?

:0:
* ! VARIABLE ?? .*
VARIABLE=defaultvalue

No, that won't work.  You need the $ to force procmail to expand
VARIABLE.  Also, the * may allow procmail to match zero "."s, which will
always match.  Third, you need curlybraces so that your action is
taken as an action.  This should work:

:0
* $! $PANGALACTIC^0
{ PANGALACTIC=gargleblaster }

Regards,

GReg
-- 
Gregory S. Sutter                       "How do I read this file?"
mailto:gsutter(_at_)pobox(_dot_)com                "You uudecode it."
http://www.pobox.com/~gsutter/          "I I I decode it?"

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