procmail
[Top] [All Lists]

Re: copy subject content to body

1998-01-25 05:10:58
On Sun, 25 Jan 1998 13:16:40 +0200 (EET), I wrote:
    | sed -e "\$a\\${NL}SUBJECT>${SUBJECT}\\${NL}<SUBJECT\\${NL}"
<...>
Note that this avoids spawning any shell at all (that's basically the
primary reason why this is better than formail plus echo). If you need
to run a sed script which contains one of the SHELLMETAS characters,
you might want to muck with SHELLMETAS temporarily to avoid spawning a
shell.

Ahem. Sorry. < and > are in SHELLMETAS -- I had been testing this with
a sed script which didn't contain the > and <.

So here's the version which doesn't spawn a shell:

    NL="
"
    SAVEDMETAS="$SHELLMETAS"
    SHELLMETAS=

    :0fh
    | sed -e "\$a\\${NL}SUBJECT>${SUBJECT}\\${NL}<SUBJECT\\${NL}"

    SHELLMETAS="$SAVEDMETAS"

Incidentally, is there any good way to know when a shell is being
spawned? In a VERBOSE log, you'll see this when running a shell:

    procmail: Executing " sed -e 1d -e 2d ;"

whereas the individual arguments are separated by commas when the
program is being execed directly:

    procmail: Executing "sed,-e,1d,-e,2d"

I was playing around with putting something in my shell's startup
files to tell me when Procmail is starting up a shell, (so as to avoid
running a VERBOSE log just to find that out) but wasn't very
successful. Any ideas?

/* 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>