procmail
[Top] [All Lists]

Re: Getting the Score

1996-07-13 23:05:52
Jim Osborn asked,

I take that to mean that $= is set even if the recipe comes up negative.
My question is: how can I print out a negative score?

I've tried, for test purposes:

:0 B
* -1^1 ^.*$
{ SCORE=$= }

Your analysis was right, Jim: because the score is negative, the recipe
fails, so $= gets defined but $SCORE does not.  Try this:

  :0B
  * -1^1 ^.*$
  { }
  SCORE=$=

Now, to the rest of it ...

:0 fWhb
| cat - >/dev/null; echo "score is: $SCORE"

You don't need "cat - > /dev/null;" nor the shell it requires, just the `i'
flag; and hb is the default, so you don't need "hb" either:

  :0fWi
  | echo "Score is $SCORE."

:0
|

A filter plus a save to "|" do seem necessary to get the result dumped to
stdout, though.  Just this instead:

  :0hi
  | echo "Score is $SCORE."

didn't seem to send it anywhere.  The stdout of a pipe action appears not to
be connected to the stdout of procmail.

How can I get that score, whatever its value?
I've tried every bracketing variation I can think of, to no avail.

Try the one I suggested above.  This looks like a second good use for { } as
a no-op.

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