procmail
[Top] [All Lists]

Re: Recurring Non-changing Email : Filter

1999-01-07 11:19:23
On Thu, 7 Jan 1999 10:15:30 -0600, 
toddl(_at_)t045(_dot_)dseg(_dot_)ti(_dot_)com 
(Todd Lindstrom) wrote:
Here was my first thought but I'm stuck as you will see:
:0
* ^Subject:.*Daily uard
{
  :0 b
  | cat >! /tmp/uardmsg ; <diff here>
but I dont know how to get the result of the diff into a variable
so I can check to see if it is a 0 (diff returns 0 on no difference)

You don't need that. The result code will be in $? just like in the
shell but just follow this with

    :0E  # sink to /dev/null if previous recipe was successful
    /dev/null

However, This can be tightened up with something like this:

    :0  # We don't really want a match on e.g. "Re: Daily uard"
    * ^Subject:[        ]*Daily uard
    {
        :0B
        * ? diff old-uard
        /dev/null

        # If we fall through to here, it means diff returned some differences
        :0bc:  # stash a copy of the body, then proceed as with all other mail
        old-uard
    }

and that should be pretty much it. (There is a race condition; you
need a regional lock if you might receive two matches on the same
condition in rapid succession.)

Hope this helps,


/* era */

-- 
.obBotBait: It shouldn't even matter whether    <http://www.iki.fi/~era/>
I am a resident of the state of Washington. <http://members.xoom.com/procmail/>

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