From owner-freebsd-questions Fri Sep 20 20:38:31 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id UAA15879 for questions-outgoing; Fri, 20 Sep 1996 20:38:31 -0700 (PDT) Received: from foo.netvoyage.net (ip187.lax.primenet.com [204.212.59.187]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id UAA15853 for ; Fri, 20 Sep 1996 20:38:27 -0700 (PDT) Received: from localhost (bkogawa@localhost) by foo.netvoyage.net (8.7.5/8.6.12) with SMTP id TAA17577; Fri, 20 Sep 1996 19:11:09 -0700 (PDT) X-Authentication-Warning: foo.netvoyage.net: bkogawa owned process doing -bs Date: Fri, 20 Sep 1996 19:11:08 -0700 (PDT) From: "Bryan K. Ogawa" X-Sender: bkogawa@foo.netvoyage.net Reply-To: "Bryan K. Ogawa" To: Ryan Loots cc: FreeBSD questions Subject: Re: egrep and Variables In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk On Fri, 20 Sep 1996, Ryan Loots wrote: > Hi There > > I would like to alter my .procmailrc to allow searches for strings in > variable names, for example: > > ====snip==== > LOCALDOMAINS=(blah.com|blah.co.za|blah.org.za) > > :0: > *TOjsmith@$LOCALDOMAINS > /home/jsmith/mail/personal > ====snip==== > > Of course, the problem with this is that egrep '$LOCALDOMAINS' looks for > the text 'LOCALDOMAINS' after an end of line. How cute. > > Any suggestions on how to force the egrep that procmail spawns to search > for variable names would be welcome. :) I might not normally reply to this message, but I was futzing with procmail (to move a bunch of mailing lists I'm getting, like this one, to run on my local news server, so I can read freebsd-questions from nn instead of pine), and came across the following: {foo} ~ 18:49 ttyp6 > man procmailrc PROCMAILRC(5) PROCMAILRC(5) [snip] A line starting with ':' marks the beginning of a recipe. It has the following format: :0 [flags] [ : [locallockfile] ] Conditions start with a leading `*', everything after that character is passed on to the internal egrep literally, except for leading and trailing whitespace. These regular expressions are completely compatible to the normal egrep(1) extended regular expressions. See also Extended regular expressions. [snip] Flags can be any of the following: [...] $ Evaluate the remainder of this condition according to sh(1) substitution rules inside double quotes, skip leading whitespace, then reparse it. So... perhaps try something to the effect of: ====snip==== LOCALDOMAINS=(blah.com|blah.co.za|blah.org.za) :0: * $TOjsmith@$LOCALDOMAINS /home/jsmith/mail/personal ====snip==== That's just a guess from the manual, though. Look at the man pages and maybe there's an example somewhere. The man pages for procmailrc(5) and procmailex(5) look helpful. The other thing is that that expression for LOCALDOMAINS looks weird. I could be wrong, however. > > ____ > Ryan > _____________________ > UUNet Internet Africa > http://donald.iafrica.com > > It is the business of little minds to shrink. > -- Carl Sandburg > > bryan k ogawa http://www.primenet.com/~bkogawa/