procmail
[Top] [All Lists]

Re: truncate

2003-07-13 00:44:29
On Tue, Jun 17, 2003 at 10:39:57AM -0500, David W. Tamkin wrote:
Dave Stern asked,

I have what I thought was a simple rule to truncate messages:

:0:
* ^Subject:.*test
* > 1000
| head -100 >>$MAILDIR/truncated

procmail: Error while writing to " head -100 >>$MAILDIR/test"

If the action line of a recipe doesn't read in the entire feed area,
procmail believes that there has been a write error.  When you
actually want it that way, add the `i' flag as the procmailrc(5) man
page says, and procmail will know that write errors are not a problem
there.

That's of course true, and fine advice.  (I'm catching up on old
postings from while I was out of town.)  It looks like, so far
in this thread, anyway (and I thought it would have come up by
this time in the thread), nobody has asked why you are bothering
to use $MAILDIR in the path.  While it shouldn't break anything,
it is neither necessary nor logical to do so.  $MAILDIR is
procmail's internal equivalent to the chdir command on the
Unix command-line.  $MAILDIR is, by definition, where we are
already, if you are not actually changing its value with a new
assignment statement (such as "MAILDIR = otherdir").

So it is much better to simply write:

        | head -100 >> truncated


-- 
dman

_______________________________________________
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>
  • Re: truncate, Dallman Ross <=