feren(_at_)ctron(_dot_)com (Andrew C. Feren) writes:
I was trying to write a rule to match dollar signs ('$'), but
procmail always seemed to treat the $ character specially no
matter how I quoted or escaped it. I ended up using the
pattern "[^ -#%-~]".
Is this really the best way to do this?
I would have to say "no". Probably the best way to always match a
literal dollar sign is enclose it in square brackets:
[$]
You can also 'backwhack' it, ala:
\$
but that fails if you're doing variable expansion of the condition, or
if it's at the beginning of the condition. You could then double the
backslash, but that's more confusing then the bracket solution.
Similarly, if you're doing variable expansion of the condition and you
want to match an end-o'-line, then you can enclose the dollar-sign in
parens:
($)
Kudos to David Tamkin for being the primary 'evangelist' of this idea.
Philip Guenther