On 9-Jan-2008, at 19:50, David W. Tamkin wrote:
LuKreme wrote:
Well, in theory, yes. But since VAR2 is defined as simply
VAR2=`echo $VAR | tr "[:upper:]" "[:lower:]"`
I don't think there is any reason for the anchors.
Or the \VAR2 really.
* $ ! VAR ?? $VAR2
would be fine.
Do you have any other use for $VAR2? If the only reason you're doing
all this is to find out whether $VAR has any upper case letters (and
therefore would differ from $VAR2), then
:0D
* VAR ?? [A-Z]
action
will do the job without the shell call and without the tr call.
Well, if VAR has any upper case letters I replace it with a case-
folded version. Here's the whole recipe, with an explanation:
---cut
LOG=$NL$NL\$USER=$USER$NL
# Evidently postfix's pipe sometiems sends, or procmail receives, a
# non-case folded username. After trying to isolated the issue, I
# have punted and simply check the incoming username for uppercase
# characters like so:
USER1=`echo $USER | tr "[:upper:]" "[:lower:]"`
LOG="\$USER=$USER \$USER1=$USER1$NL"
:0D
* $ ! USER ?? $\USER1
{
LOG="Translated $USER to $USER1$NL"
USER=$USER1
}
LOG=\$HOME=$HOME$NL
---cut
Now, I could wrap the whole thing in a check like above and only do
the shell call if USER contains [A-Z], but I'm not seeing much of a
hit from the shell. I probably should do it anyway, I suppose.
--
You think you can catch Keyser Soze? You think a guy like that comes
this close to getting caught, and sticks his head out? If he comes up
for anything it'll be to get rid of me. After that… my guess is you'll
never hear from him again.
____________________________________________________________
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