On 5/9/05, Dallman Ross <dman(_at_)nomotek(_dot_)com> wrote:
Would someone please show me a simple use of SHIFT
in procmail?
Sendmail's "local procmail" mailer invokes procmail like this:
procmail -t -Y -a $h -d $u
When sendmail receives an envelope-to address such as
<dman+procmail(_at_)nomotek(_dot_)com> the part between the + and the @ is $h.
So procmail is invoked with $1 set to "procmail" in that example.
Given this, the assignment
SHIFT=1
will replace the current value of $1 with the value of $2, $2 with $3,
etc. In the example so far, there is no $2, so $1 becomes unset.
Now consider sendmail's "procmail" mailer, which invokes procmail like this:
procmail -Y -m $h $f $u
This tells procmail to read the rcfile named by $h. Within that file,
$1 is intially set to the envelope-from address (sendmail's $f) and $2
is set to the envelope-to address (sendmail's $u). In this case
SHIFT=1 discards the envelope-from and makes $1 the envelope-to.
SHIFT=2 behaves similarly, but it moves $3 to $1, $4 to $2, etc.,
discarding two values off the "low end" of the list. And so on for
SHIFT=3, SHIFT=4, ...
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail