On 9 Jan, LuKreme wrote:
OK, I seem to be having a brain cloud.
I want to compare to variables and see if they are identical,
including case. I thought this might do it:
:0
* ! VAR ?? $VAR2
but it doesn't. Sure I am forgetting something very basic. Here is
the code:
LOG=$NL\$VAR=$VAR$NL
VAR2=`echo $VAR | tr "[:upper:]" "[:lower:]"`
LOG="\$VAR=$VAR \$VAR2=$VAR2$NL"
:0
* ! VAR ?? $VAR2
{
LOG="Translated $VAR to $VAR2$NL"
VAR=$VAR2
}
But procmail, regardless of the values in VAR and VAR2 says
procmail: Match on ! "VAR2"
or is this simply that "BOB"="bob" to procmail? If so, what's the
best way for me to check if VAR and VAR2 differ in case?
Actually, a couple of brain clouds.
First, you need a "$" at the beginning of the condition to have
procmail expand the variable to the right of the "??" operator.
Then, if you want the condition to be case sensitive, you need
a "D" flag. Next, you would need to anchor the $VAR to the right.
Remember, it's a regular expression.
Lastly, you probably want to use $\VAR if there can be any special
characters in $VAR. For example, VAR=one.three would match one2three.
If you know there can never be any special characters, then you
could skip this last suggestion. (How you could *know* that, I can't
fogure. That's kind of like my kids specifically remembering that
they didn't do something, but I digress.) Putting it all together:
:0 D
* $ ! VAR ?? ^^$\VAR2^^
I think I've thought it through, but it is about 3 hours past my
bed time, so treat it with due skepticism.
--
Email address in From: header is valid * but only for a couple of days *
This is my reluctant response to spammers' unrelenting address harvesting
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail