procmail
[Top] [All Lists]

pipes in conditions

1997-04-10 14:55:00
James McGill had asked,

| > Perhaps I am missing something fundamental... is there an
| > easy way to *use* perl or egrep instead of the * line in 
| > a recipe?

Tim <bodysurf(_at_)pobox(_dot_)com> suggested,

| Sure, I use it in combination with `echo` to check the exitcode of
| `egrep` like in this recipe:
| 
|       #
|       # Check to see if this email is from a "friend".  If so, stick it
|       # in my INBOX.
|       #
|       :0
|       * ? echo "`formail -rtxz'To:'`" | egrep -i -f $HOME/friends
|       $DEFAULT
| 
| The recipe is fairly self-explanatory.

I don't see a reason for capturing the stdout of a program and then
echoing it to a pipe; just pipe the program's stdout itself:

        * ? formail -rtzxTo: | egrep -i -f $HOME/friends

I should also point out that the "z" has to come before the "x", or
formail will try to find a field in the inverted head that is named
"Zto:".

<Prev in Thread] Current Thread [Next in Thread>
  • pipes in conditions, David W. Tamkin <=