procmail
[Top] [All Lists]

EXITCODE depening on invoked script (or: fetch return/output of pipe)

2002-04-13 05:33:36
somehow I'm stuck with this:

my procmailscript calls a perl-script that returns an errorcode
(according to /usr/include/sysexits.h ) and now I want my
procmailscript have returned this very errorcode back to the invoking
mailer (=sendmail)

by now I use:

------------------------
:0 w
| /usr/local/sbin/mailscripts/mail_ext.pl x$1 x$2 "x$SUBJECTX" "x$TOX" x$DAEMON
 
# if the previous script fails return 1 which means the mail was not delivered
 
EXITCODE=67;
------------------------


but this would always return 67 to sendmail if the errorcode returned
by my perlscript was not zero ... even if the error was 75 or anything
else ...

I need a way to catch the exitcode of the script and assign it to
EXITCODE.  I could even alter the perl-script so it returns the
exitcode on stdoutput too.

Is it possible to write something like: 

------------------------
:0 w
result=`| /usr/local/sbin/mailscripts/mail_ext.pl x$1 x$2 "x$SUBJECTX" "x$TOX" 
x$DAEMON`
 
# if the previous script fails return 1 which means the mail was not delivered
 
EXITCODE=$result;
------------------------

looks weird ...

thnx for any idea,

peter


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