procmail
[Top] [All Lists]

Re: how to test condition: variable set but not empty

2002-06-20 20:52:38
Timothy wrote,

| At the end of the RC file, I want to take 4 actions if, and only if, the
| corresponding variable has been set to something other than ""

and this is the condition:

| * $ ! ${SUBJECTTAG+!}

That condition will pass if the variable is set (even if it's null) and will
fail only if it's unset.  You want one that will fail if the variable is null
or unset and will pass only if the variable is non-null.  Some possibilities
are these:

 # note the colon
 * $ ! ${SUBJECTTAG:+!}

or

 * ! SUBJECTTAG ?? ^^^^

This one is flawed, because it will fail if the contents of $SUBJECTTAG are
one or more newlines with no non-newline characters:

 # this is wrong
 * ! SUBJECTTAG ?? .



_______________________________________________
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>