procmail
[Top] [All Lists]

Re: Procmail-recipe problem!

1998-02-23 08:47:29
David brought up some valid points I'd like to share with those who
are interested in this thread. 

On Mon, 23 Feb 1998 09:19:42 -0600 (CST), dattier(_at_)wwa(_dot_)com 
(David W. Tamkin) wrote:
| I'd normally use multiple echo's, I just wanted to show that it can be
| done with only one.
Only if there is no shell triggered or if $SHELL is sh or sh-based.  If a
shell is invoked and it is csh or a csh derivative, it probably won't work
because those shells can't handle a newline inside quotes properly.  That's
why I use multiple echo commands when I suggest procmailrc code on the
mailing list.

(People using t?csh are doomed anyhow. But multiple echos are
certainly more readable and easier to maintain and thus better unless
you +really+ want to save those extra processes. [There won't even be
any extra processes if echo is built into your shell.])

| Or you could simply ditch the real headers and by happy coincidence
| have the auxiliary headers "promoted" to be the new headers of the
| message:
|     :0fhi
|     | /bin/true  # just discard original headers
Two potential problems: first, I'm not sure that procmail won't put a blank
line at the top when it glues the new (emptied-out) head back onto the body;

I tried it before I posted, but that's of course no guarantee that it
will work in all situations.

second, won't something need to regenerate the From_ line for most users?
       :0f # no r
       | sed 1,/^$/d
should do it, I believe; or in case there are blank lines at the top of the
body before the new header lines start,

      :0f
      | sed -ne 1,/^$/d -e '/./,$ p'

These are certainly valid points. I was going to suggest a sed script
at first, but then I thought of just discarding the original headers.
But this is safer and not exactly very expensive, either.

/* era */

-- 
 Paparazzi of the Net: No matter what you do to protect your privacy,
  they'll hunt you down and spam you. <http://www.iki.fi/~era/spam/>

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