eldarion99
Programmer
I have inherited this wierd code, in which I execute a child script. I'm trying to pass back the return code, as follows:
#/bin/ksh
bunch of initialization stuff
integer saverc
(date
...
child_script.sh
saverc=$?
echo "saverc is $saverc" #produces saverc is 3
if [ $saverc -ne 0 ]
then
exit $saverc # this exits the parenthesis with a 3
fi
date
) 2>&1 > $LOGFILE
echo "saverc is $saverc" #produces saverc is 0
I've tried using an export of saverc both at the very top, and at the top of the parenthesis. Anybody know what I'm doing wrong? All responses are appreciated very much!!
Thanks.
#/bin/ksh
bunch of initialization stuff
integer saverc
(date
...
child_script.sh
saverc=$?
echo "saverc is $saverc" #produces saverc is 3
if [ $saverc -ne 0 ]
then
exit $saverc # this exits the parenthesis with a 3
fi
date
) 2>&1 > $LOGFILE
echo "saverc is $saverc" #produces saverc is 0
I've tried using an export of saverc both at the very top, and at the top of the parenthesis. Anybody know what I'm doing wrong? All responses are appreciated very much!!
Thanks.