Re: proper way to assign return value to a variable

Holger Wahlen <[email protected]>
Newsgroups gmane.mail.procmail
Message-ID <[email protected]>
* Richard Reina wrote:
> :0 w # send to test_subject.pl check for order no.
> * ? /usr/bin/perl -e 'require "/home/richard/.pmdir/test_subject.pl"; test_subject($ENV{SUBJECT};'
> 
> This works fine, but what I need is to capture the return value of the
> script so that I can compare it in a conditional and depending on the result
> use it in another called script.

Actually "?" conditions make it even easier to do what you want, you
don't need to capture the return value yourself and compare it to 0
explicitly in later recipes: if you add an action line to your recipe,
this action will only be executed if the script returns 0, and you can
add another recipe with an "E" flag to deal with the "else" case.

:0
* ? your_perl_script
| pipe_to_execute_if_script_returns_0

:0 E
| pipe_to_execute_if_script_returns_something_else

/HW
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.