procmail
[Top] [All Lists]

Re: testing if a variable is EMPTY

1997-01-07 19:57:23
On Mon Jan 06 1997, Timothy J Luoma wrote:

I'd like to test if a variable has been set but has nothing as its
contents.

I haven't been able to find any examples of this, but I'm sure it's
a rather simple matter

All I want to do is:

if [ "$MyVar" = "" ]
then
      do this
else
      do that
fi

I don't know how to do that in procmailese.

(You'll probably get lots of answers to this one:)

Use the same technique as is used with shell scripts...

if [ X"$MyVar" = X ]
then
        do this
else
        do that
fi

For example...

KEEPALL

# --- Store a copy of every incoming mail into a backup file ---
#
:0Wc:
* ? test x$KEEPALL = xyes
IN.backup

Cheers
Tony

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