procmail
[Top] [All Lists]

A case where grep cannot fail! A question of SHELLMETAS?

2000-09-29 09:45:01
Hi folks,

        I ressurected an old procmail script of mine, which works in a
different context (recovering new URLs), but seems that it cannot fail
here:

:0
*$ LINES ?? ()$From:\/.*${NAME}.*$
{
    FROM = $MATCH

    :0 A
    *$ ? $GREP -s "'"${FROM}"'"  $DIR/${NAME}*
    {
        FOUND = 1
    }

    :0 E
    {
        FOUND
    }
}

Now, simply this script is called within another, and one of the
possibilities for LINES is the entire "From: " line.  In this case, if
the e-mail is from a particular person, whose name comes in as NAME,
then if a GREP finds a previous e-mail with the same From: line in the
files under $DIR/${NAME}*, then FOUND is set to 1, and otherwise it is
unset.  Variables are initalized to:

GREP    = "/bin/fgrep"
DIR     = "$HOME/mail/Family"

In a particular test case I have:

From: "Donna M. Schumacher" <dandeschu(_at_)earthlink(_dot_)net>

which is in the files, and another test case:

From: "Donna Schumacher" <dandeschu(_at_)earthlink(_dot_)net>

which is not in the files.  From some debug output I have:

procmail: Assigning "FROM= "Donna Schumacher" 
<dandeschu(_at_)earthlink(_dot_)net>
"
procmail: Executing " /bin/fgrep -s "${FROM}"  
/home/sobek/mail/Family/Schumacher*"
procmail: [24762] Fri Sep 29 14:45:51 2000
procmail: Match on " /bin/fgrep -s "${FROM}"  
/home/sobek/mail/Family/Schumacher*"
procmail: Assigning "FOUND=1"


Why is this so?  Is it because of the <> or the 2 double-quotes?  I
need SHELLMETAS to expand the * for the file names.

In the recipe I pass $FROM between single quotes.  Do these get used
as such?

When I tested fgrep by itself, having the argument between
double-quotes would cause fgrep to fail.  $FROM has to be with
single-quotes around it.

Does anybody see my error?  By the way, this is still procmail 3.14.

Cheers to all,

        --Ralph

Dr. Ralph P. Sobek                Disclaimer: The above ruminations are my own.
Ralph.Sobek @ irit.fr           
sobek @ irit.fr                                    http://beeline.to/genealogy/
Ph:(+33)[0]561558618   FAX:(+33)[0]561556258   http://www.irit.fr/~Ralph.Sobek/
===============================================================================
Estimates are that one-third to two-thirds of animal and plant species will 
disappear in forseeable future!  AWFUL!
  SPAMMERS Beware: http://www.irit.fr/~Ralph.Sobek/welcome.shtml#Mail-Warning



_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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