procmail
[Top] [All Lists]

Re: Fighting with the use of variables in .procmailrc

1999-06-08 16:17:46
At 06:40 PM 6/8/99 +0200, Bernard Debray wrote:
Hello everybody.

I am trying to use procmail to send back a different mail message,
depending on the value of a variable which is set inside a perl script
(so it has to be an environment variable).

Here is my .procmailrc file (the login shell is tcsh) :

My login shell is also tcsh but I use only sh inside of .procmailrc
(and only sh derivatives for programming)... so should you.

set VERBOSE=on

This is still executed as if sh (in procmail's syntax, technically),
since it doesn't require a shell.  Note in your log, a variable "set"
is unset, and VERBOSE is set to "on" which is OK perhaps, but
only by coincidence.

Put
   SHELL=/bin/sh
and make everything for the Bourne shell and you'll be much better off
(*trust* me on this :)

Anyway,
setenv ALLR_REG="FALSE"

same comment.  BTW, all assigned variables go into the environment
anyway, so simply
   ALLR_REG=FALSE
suffices.

:0w:
| bin/test_registrd_usr.pl $SENDER > $TMPFILE 

:0:
* ALLR_REG ?? FALSE

Oops.

In shells, a child can't set an environment variable of it's parent.
Nor can the child of any other process, including procmail.

You'll have to retrieve your result another way... either by
setting exit status of your perl script, or getting something
from its output (in $TMPFILE, it appears)

Hope that gets you started anyway.

Cheers,
Stan

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