procmail
[Top] [All Lists]

Re: setting and testing variables

2001-04-24 11:36:01
On 24 Apr, Marshal Benton wrote:
| [snip]
| 
| I want to set a variable "VALUE" to a value
| of GOOD or BAD, depending on the results of
| a test. In subsequent recipies I want to test
| the value of the variable "VALUE".
| 
| Here is the part of my rc file.
| 
| =-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| VALUE = ""
| 
| :0
| * ^From:.*myrealbox.com
| { VALUE=GOOD }
| 
| :0 E
| * ^(From|Cc|To):.*infobeat\.com
| { VALUE=GOOD }
| 
| :0
| * $VALUE ?? ^^^^
| {
|    :0 H
|    * ^Message-Id: <[^(_at_)]+>
|    { VALUE=BAD }
| }
| 
| :0
| * ! $VALUE ?? GOOD
| *  ^Subject:.*S E X
| { VALUE=BAD }
| 
| =-=-=-=-=-=-=-=-=-=-=-=-=
| 
| When testing for the value of VALUE,
| should the test line be
| 
| *$ $VALUE ?? GOOD
| and
| *$ ! $VALUE ?? GOOD
| 
| My news server is disfunctional so if you would, please
| inlude my return address in the reply.
| 
| [snip]
| 
| On Thu, 19 Apr 2001, David W. Tamkin wrote:
| 
| -->Date: Thu, 19 Apr 2001 22:50:37 -0500 (CDT)
| -->From: David W. Tamkin <dattier(_at_)ripco(_dot_)com>
| -->To: Procmail Mailing List <procmail-users(_at_)procmail(_dot_)org>
| -->Subject: prepending text to the subject
| -->
| -->[snip]

What does this quoted message have to do with the new thread?  And at
the very least, it doesn't take much to trim the list footer so it
doesn't get quoted back to the list multiple times.  Does it?

I don't know what a broken news server has to do with it, but request
for cc: granted - at the risk of being branded something not nice.
(Couldn't resist.) <g>

As for your question, I have always used:

* VALUE ?? GOOD

but you got me thinking and this also works:

* $VALUE ?? GOOD

My understanding and usage is the '$' condition modifier is used if the
right side needs expanding, for example I have the following condition
in a recipe of mine:

* $ XENVELOPETO ?? .*\/$DOMAINS

which requires the expansion of the $DOMAINS variable, hence the use of
the '$' modifier.  This at least is the way I understand it.

Don Hammond



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