procmail
[Top] [All Lists]

Re: MATCH question

2003-02-23 07:15:18
On Sat, Feb 22, 2003 at 09:46:43PM -0500, fleet(_at_)teachout(_dot_)org wrote:

Dallman, thanks for this explanation.  This has to do with the
"specialness" of MATCH in procmail; ie, MATCH is not an "ordinary"
variable?

No, not at all.  That's why I tested it with a different variable
altogether ($QUOTE).

Remember, on a condition line, $VAR won't be expanded unless
we tell procmail to use sh-style variable expansion via a leading
eval token.  From `man procmailrc':

       $    Evaluate the remainder of this condition according to
            sh(1) substitution rules inside double  quotes,  skip
            leading whitespace, then reparse it.

In your example, nothing problematic was being evaluated or expanded,
so the extraneous $ posed no problem.  It didn't bother procmail
that there was no whitespace.  One could write this:

        *!$VAR??$ANOTHER_VAR

and it would work fine.  With spacing, it's easier for humans
to read:

        * ! $ VAR ?? $ANOTHER_VAR

We can test the squished-together syntax:

        VAR = foo
        ANOTHER_VAR = foo

        :0
        *$VAR??$ANOTHER_VAR
        { 
            LOG = "
                   Recipe succeeded
                  "
        }


Here is my test-harness verbose log output:

 procmail: Assigning "VAR=foo"
 procmail: Assigning "ANOTHER_VAR=foo"
 procmail: Match on "foo"
 procmail: Assigning "LOG=
                   Recipe succeeded
                  "

-- 
dman

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