procmail
[Top] [All Lists]

Re: Changing Mail Headers for messages sent to the list (Re:

1997-01-07 16:22:54
Stan Ryckman <stanr(_at_)sunspot(_dot_)tiac(_dot_)net> writes:
...
And why is
$@ in double quotes; won't that turn all the switches and
arguments into one argument to sendmail, containing spaces?

Beware: "$@" != "$*".  The latter is equivalent to
        "$1 $2 $3 $4..."
while the former is equivalent to
        "$1" "$2" "$3" "$4" ...

That is, "$@" preserves the list structure of the argument vector,
neither smashing it into one word like "$*", nor resplitting it on $IFS
like $*.  I would say that most uses of $* in shell scripts should
really be "$@", but the programmer either didn't know about $@ or
didn't care (a reasonable choice for many personal scripts).

...
I'm guessing it should look like this:

#!/bin/sh
sed 's/^Subject: Re: \[Procmail\]/Subject: Re:/' | /usr/lib/sendmail $@
exit 0

1) You should use "$@" to avoid splitting up address that contain whitespace.
2) You should leave out the "exit 0" so that the return status of sendmail
        is used as the return status of the whole script, so that it may
        be checked.  If leaving out the "exit" command bothers you, then
        you can just leave out the zero, and it will use the return status
        of the sendmail process.

Philip Guenther

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