procmail
[Top] [All Lists]

Re: need help with example in 'man procmailex'

2006-07-09 02:33:20
On Sun, Jul 09, 2006 at 02:04:02AM +0000, Pollywog wrote:

The following example is given in 'man procmailex' approx line
164

The question concerns the line

* $^To:.*\<$\LOGNAME\>

Why is there a "\" between the "$" and the "L" ? I understand why
the other "\" are needed.

First, you may not understand what you think you understand. :-)

The slashes in "\<" and "\>" are not "quotes" in the standard
sense.  Rather, those two pairs of characters represent a
procmail-only special "macro" character set.  (Both representations
mean the same thing, actually.  The only reason to have the greater-
than or less-than sign point in one or the other direction here is
aesthetic for the coder.)  Look in "man procmailrc" and search for
"\<" or its paired partner.

The "$\name" syntax is likewise mentioned in the procmailrc man
page, albeit in the "bugs" section (though it's not really a "bug";
the author is using "bug" for "miscellaneous" or such here, I
take it).  But the explanation is very brief and easy to fail
to grasp.  Basically, "$\name" quotes any special characters
that otherwise would assume their normal wildcard function.

For example, suppose $LOGNAME is "dallman.ross" (and I do have one
such login and email address on one ISP).  If we just look for that
unquoted, and if there is another user whose $LOGNAME is "dallmancross"
instead, we'd have a false match thereon.  The "$\" ensures that
won't happen.  The dot will get quoted.

While in actuality I'm the only person in the known world who uses
"Dallman" as a first[1] name (and this does have some spam-fighting
advantages), we can consider the more common, hence more troublesome,
example of someone named "Bob Hite" whose email address might be
"bob.hite" -- and whose fellow user might well be "bobwhite".
You can see the need to avoid false positives in such matches.
Similar further examples abound, also using my last name, such as
"bob.ross" and bobcross", etc., etc.

The use of "$\name" in other variable comparison examples in
procmail conditions is even more likely to be needed and useful.


[1] It's actually my middle, or "second-first," name.  My name is
also the name of a fictional character in the _Highlander_ science
fiction series from the mid-1990s (guest character in a couple of
episodes starting with "The Lamb"), which name the writer swiped
from me and which fact of its use has continued simultaneously
to vex and to flatter me.  (It certainly disturbs web search results
that attempt to concentrate on me, for example.)

Dallman

____________________________________________________________
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

<Prev in Thread] Current Thread [Next in Thread>