I want to execute a command then get the return value of this command. when it's done i want to exit and give exit the return value of the previous command, the one i just executed. I already have this piece of code but it doesn't seem to work.
exec gosu user /var/www/bin/phpunit -c app
typeset ret_code
ret_code=$?
if [ $ret_code == 0 ]; then
exit 0
fi
exit 1
how can i do it ? thanks
return $?orreturn $ret_codeimmediately afterexec...? Or am I missing something?$?will always be non-zero if you reach code followingexec.execonly returns if it fails.