procmail
[Top] [All Lists]

Re: Env Var expansion in procmail filters?

1997-10-27 08:00:58
Walter Dnes asked,

|     I'm trying to make my .procmailrc at least partly generic,
| so that it can be used by other people with minor changes.  E.g.
| I use $DEFAULT instead of /var/mail/waltdnes.  Can I use
| 
| "* !^(To|Cc|Bcc):.*$LOGNAME" instead of "* !^(To|Cc|Bcc):.*waltdnes"

Almost.  If you want variable substitution or command substitution in a reg-
exp condition, you need to put the "$" modifier in front of it, like this:

 * $ ! ^(To|B?cc:).*$LOGNAME

Also, you're probably better off with procmail's ^TO_ token (or ^TO if your
version doesn't have ^TO_) if you're trying to match addressees:

 * $ !^TO_$LOGNAME

|     I know that comments aren't allowed in the middle of a
| multi-condition filter ...

The most recent versions do allow whole-line comments in the middle of
a recipe; they do not, however, allow a comment to the right of a regexp
condition or a size condition, sharing the same line.

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