procmail
[Top] [All Lists]

Re: boolean condition?

2002-01-10 10:25:20
On 10 Jan, John Conover wrote:

[ top posting fixed ]

| Professional Software Engineering writes:
| > At 08:45 2002-01-10 +0000, John Conover wrote:
| > 
| > >How do you do a strict boolean condition? Something like
| > 
| > [...]
| > # enable/disable the filters
| > SOMEFLAG=on
| > 
| > :0
| > * SOMEFLAG ?? on
| > * someother condition, etc
| > 
| > or, if you want to check for it being set AT ALL:
| > 
| > :0
| > * ! SOMEFLAG ?? ^^^^
| > 
| 
| Thanks. After some diligence:
| 
| SOMEFLAG="on"
| 
| is not the same as:
| 
| SOMEFLAG=on
| 
|       John
| 

PMFJI, but Huh?  Unless I completely misunderstand this assertion, or
this behavior is procmail version dependent with some versions doing
something completely unintuitive with quoting (which I seriously doubt),
it isn't correct.

$ cat ./.this
DEFAULT=/dev/null
NL="
"
SOMEFLAG = on

:0
* ! SOMEFLAG ?? ^^^^
* SOMEFLAG ?? ^^on^^
{ LOG = "Recipe 1 (sans quotes): SOMEFLAG=$SOMEFLAG;$NL" }

SOMEFLAG = "on"
:0
* ! SOMEFLAG ?? ^^^^
* SOMEFLAG ?? ^^on^^
{ LOG = "Recipe 2 (w/ quotes): SOMEFLAG=$SOMEFLAG;$NL" }

$ procmail ./.this </dev/null 
Recipe 1 (sans quotes): SOMEFLAG=on;
Recipe 2 (w/ quotes): SOMEFLAG=on;

You can see the quotes make no difference (illustrated both by the
anchoring of the expressions in the conditons and the LOG= output).

Of course, if you meant

* SOMEFLAG ?? on

is not the same as:

* SOMEFLAG ?? "on"

then that would be correct.

Don Hammond

-- 
Reply to list please, or append "6" to "procmail" in address if you must.
Spammers' unrelenting address harvesting forces me to this...reluctantly.


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