procmail
[Top] [All Lists]

Re: question on scoring

1997-03-31 14:21:54
Era Eriksson wrote,

| On Mon, 31 Mar 1997 17:01:42 +0300 (EET DST), I ...
| ... proceeded to nullify the possible savings by running backticks
| from within that shell. I think I deserve some little applause ;-/

OK, anyone who can, please give Era a little clap (couldn't resist). 
Anyhow,

|  >     * 1^1 ! ? exit `fgrep -cx "$FROM" $DATELOG`
| 
| This one in particular is up the wall.

And it wouldn't work, because it has no characters from $SHELLMETAS, so
no shell would run, and procmail would report that it couldn't find an
executable named "exit" in $PATH.  You'd have to (skip this if your name
is Philip Guenther) do something like this to force a shell:

         * 1^1 ! ? exit `fgrep -cx "$FROM" $DATELOG` ;

A more sensible procedure follows later in this post.

|   (If you wrote a variant of fgrep which returned the number of
| matches in the exit code, you would again not need the exit and the
| backticks but such programs are far between. The original rationale
| for the ! ? construct was probably as a generalization for the case
| where you would expect either an exit code of 1 to mean failure and 0
| to mean success.)

Some programs do return the number of occurrences of something in their
exit code, don't they?  Regardless, the stdout of a command can be used
in a score this way:

  * $ `fgrep -cx "$FROM" $DATELOG`^0

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