procmail
[Top] [All Lists]

Re: Variable not expanding properly

1997-04-20 15:25:00
ariel(_at_)best(_dot_)com (Catherine Hampton) writes:
I'm having problems with a variable not expanding properly during
testing.  Here's the setup:
...
NOLOOP=login(_at_)domain(_dot_)com

I use this as the content of the "X-Loop:" header which my script
inserts into all autoresponses.  I have tested this with a test
message, and the autoresponder recipe does in fact insert this
header properly.  (I have a test email address whose only purpose
is to bounce back an autoresponse, and tried this out with it.)

The script then tests for the presence of this header like this:

:0
* ^X-Loop: ${NOLOOP}
mailer

The problem is that my script does not spot the X-Loop header.  When
I change the variable above to "login(_at_)domain(_dot_)com" (actually, to my
noloop email address), it works perfectly.


Variable expansion is not normally done on conditions.  To quote the
procmailrc(5) manpage:

     There are some special conditions you can use that  are  not
     straight regular expressions.  To select them, the condition
     must start with:
...
     $    Evaluate the remainder of this condition  according  to
          sh(1)  substitution  rules  inside  double quotes, skip
          leading whitespace, then reparse it.


So, change your recipe to:

        :0
        * $ ^X-Loop: $NOLOOP
        mailer

If you have procmail 3.11pre then you may also want to use the
$\VARIABLE form of expansion to force literal matching of things like
periods in the value of NOLOOP (otherwise they'll match any
character).

        :0
        * $ ^X-Loop: $\NOLOOP
        mailer

Philip Guenther

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