procmail
[Top] [All Lists]

Re: How to do non-filter actions correctly?

2004-05-17 18:03:09
At 02:14 2004-05-18 +0200, Kai Schaetzl wrote:
How can I correctly do something which doesn't assign a value to a
variable or doesn't output a message to procmail?

Example (shortened):

:0
* condition
{
   :0
   DATE=|date
   #DATE=`date`

   :0
   `echo "$DATE|$MATCH|$FROM|$SMS" >> $MATCH.log`

Neither of recipes actions _read_ the STDIN, thus procmail sees write errors.

Solutions include:

You could use the same syntax and just add 'i' to the flags (see 'man procmailrc').


You could just assign date via a freestanding assignment:

        DATE=`date`

(no recipe flags and conditions needed). Note that since date doesn't take input on STDIN, piping the message is pretty useless.

Same for the echo, except to do this in a freestanding fashion, you need to assign its results to something:

        BOGUS=`echo "$DATE|$MATCH|$FROM|$SMS" >> $MATCH.log`

procmail: Error while writing to ""

'man procmail' has some wonderful explanations of what the error messages mean, and what causes them. In your case "pipe died" (the program failed to read the whole message from stdin).

Also, why does the commented line with backticks not work? I've seen
several examples assigning program output like this, but it doesn't work
for me. Instead I get the message filed to a folder of that name, f.i.
"DATE=Tue".

Because you're running it as the ACTION line of a recipe. If the :0 bit didn't preceed it, it would work just fine.

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.


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