procmail
[Top] [All Lists]

Re: Braced block and $=

2001-05-17 16:03:44
John Conover <conover(_at_)rahul(_dot_)net> writes:
There might be a bug in the way $= is handled if a receipe executes
a block:

   :0
   * -11^0
   * 4^0 something
   * 4^0 somethingelse
   * 4^0 andanother
   * 4^0 andsomeother
   {
       # do something if total >= 11
   }
   #
   :0
   * 8^0
   * $$=^0
   {
       # do something if total was >= 8
   }

The log indicates that $$=^0 is *_always_* zero. However:
...
Can anyone else verify this?

This behaviour is documented on the procmailsc(5) manpage:

MISCELLANEOUS
       You can query the final score of all the conditions  on  a
       recipe from the environment variable $=.  This variable is
       set every time just after procmail has parsed  all  condi-
       tions  on  a  recipe (even if the recipe is not being exe-
       cuted).


You'll need to save the score in another variable across the block:

        :0
        * -11^0
        *   4^0 something
        *   4^0 somethingelse
        *   4^0 andanother
        *   4^0 andsomeother
        { }
        SCORE = $=

        :0
        * $$SCORE^0
        {
                # do something if total >= 11
                # Maybe even set SCORE in here to something else?
        }

        :0
        * 8^0
        * $$SCORE^0
        {
                # Do something if SCORE > -8
        }


Philip Guenther
_______________________________________________
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>