procmail
[Top] [All Lists]

Re: Returning script return string to variable.

1999-04-18 22:39:26
wguynes(_at_)mav(_dot_)net (William Guynes) writes:
An rblchk.pl modification.
rblchk accepts msg through a pipe, via stdin, and echoes all lines to
stdout (plus an extra one).

I'm looking to change the script to say "hit" (returning an IP number)
or "miss" (returning some default value).  I'm hoping to insert this
into a procmail variable!

So, I'm trying to figure out how to accept a "copy" of the headers (or
body) via stdin, return a hit or miss to a variable, then fall through
to the next recipe.

The closest I have come so far is an example Jari's tips pages, but it
expects both a variable assigned return value and stdout output.   I
see no need to alter the message, just "hit or miss".

Are you looking for:

        # just the header
        :0 h
        var=| rblchk.pl

That catches the stdout of rblchk.pl and saves it in the varible 'var'.

Note: if you put the 'W' (or 'w') flag on that recipe then procmail
will also catch the return code which you can use to control future
actions using the 'a' or 'e' flags, or directly using the $? variable.

BEWARE: the variable will be overwritten even if the action fails.
However, you should _not_ depend on that behavior, as it may be changed
in a future release.


Philip Guenther

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