procmail
[Top] [All Lists]

Re: Procmail Quick Start pointer (& some questions)

1999-09-13 19:46:15
Nancy wrote:
On 13 Sep 1999 Rik Kabel (rik(_at_)netcom(_dot_)com) wrote:
I don't like the definition of string, especially with respect to
procmail. Under some circumstances, whitespace within a string must
be quoted, either with an appropriate number of backslashes or with
quote marks. Failure to do so may create multiple strings and undesired
consequences.

Can you point me to some info about this? I looked in the procmailrc
man page but didn't see anything.

The man pages are cryptic at best, but always explain what went wrong
once you know enough not to need them. PROCMAILRC(5) says with respect
to variable assignments:

    The  assignments  and  substitutions  of  these  environment
    variables are handled exactly like in sh(1)  (that  includes
    all  possible quotes and escapes), with the added bonus that
    blanks around the '=' sign  are  ignored  and  that,  if  an
    environment variable appears without a trailing '=', it will
    be removed from the environment.  Any program in  backquotes
    started  by procmail will have the entire mail at its stdin.

This means that an assignment such as:
    LOG=Spam found
will write 'Spam' to the log and variable 'found' will be unset and
removed. On the other hand, either of the following will log the message
'Spam found' (albeit without a terminating newline):
    LOG=Spam\ found
    LOG="Spam found"

Care must also be taken in condition lines which have a $ flag, and
are therefore parsed according to sh parsing rules (under which, for
example, multiple consecutive spaces and tabs may be treated as a single
space). There is also a warning about the way leading whitespace on
continued regular expression condition lines is handled. It is handled
differently when both inside quotes and subject to a $ flag than at
other times.

-- 
Rik Kabel          Old enough to be an adult              
rik(_at_)netcom(_dot_)com