procmail
[Top] [All Lists]

Re: Argument

2001-09-22 11:23:29
Don Hammond <procmail3(_at_)tradersdata(_dot_)com> writes:
On 21 Sep, Jonas Bj\xF6rklund wrote:
| I want to pass arguments from my procmail commandline into the .procmailrc
| file. Is this possible?

Yes.


| Like this:
| 
| # /usr/bin/procmail -m /etc/procmailrc jonas(_at_)falkenberg(_dot_)net

I *strongly* recommend that you only use the /etc/procmailrc file for
its builtin purpose of acting as the global delivery filter.  If you
want to use an rcfile with "procmail -m", name it something else.

Note that rcfiles inside the /etc/procmailrcs directory have a special
meaning to procmail's mailfilter mode.  To quote the procmail(1) manpage:

       -m   Turns procmail into a general  purpose  mail  filter.
            In this mode one rcfile must be specified on the com-
            mand line.  After the rcfile, procmail will accept an
            unlimited  number  of arguments.  If the rcfile is an
            absolute path starting with /etc/procmailrcs/ without
            backward references (i.e. the parent directory cannot
            be mentioned) procmail will, only if no security vio-
            lations  are found, take on the identity of the owner
            of the rcfile (or symbolic link).  For some  advanced
            usage  of this option you should look in the EXAMPLES
            section below.

If you don't want to do that with an rcfile, then don't put it in the
/etc/procmailrcs/ directory.


Hmm, "falkenberg".  Are you a fan of Jerry Pournelle?


| /etc/procmailrc:
| 
| :0
| ! $1
| 
| Where $1 should be jonas(_at_)falkenberg(_dot_)net(_dot_)

Yes.  You must be running procmail version 3.11pre4 or later for this
to work.


Not as far as I know. But you should be able to do:

# procmail -m /etc/procmailrc NEXTHOP=jonas(_at_)falkenberg(_dot_)net

Uh, no.

$ procmail -h 2>&1 | grep -e -m
   Or: procmail [-ptY] [-f fromwhom] -m [parameter=value] ... rcfile [arg] ...
        -m              act as a general purpose mail filter
$ 

Variable assignments must go *before* the rcfile when procmail
is invoked with -m.  Everything after the rcfile shows up in $1,
$2, etc.  The invocation you gave will leave NEXTHOP unset and put
"NEXTHOP=jonas(_at_)falkenberg(_dot_)net" into $1.


Philip Guenther
_______________________________________________
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>