Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Sep 1996 19:11:08 -0700 (PDT)
From:      "Bryan K. Ogawa" <bkogawa@primenet.com>
To:        Ryan Loots <ryan@donald.iafrica.com>
Cc:        FreeBSD questions <questions@freebsd.org>
Subject:   Re: egrep and Variables
Message-ID:  <Pine.BSI.3.94.960920185807.17201B-100000@foo.netvoyage.net>
In-Reply-To: <Pine.BSF.3.95.960920145137.18308k-100000@donald.iafrica.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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] ]
              <zero or more conditions (one per line)>
              <exactly one action line>

       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  <bkogawa@primenet.com>   http://www.primenet.com/~bkogawa/





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSI.3.94.960920185807.17201B-100000>