I want to source a file eg name.sh from another script and check the return code and decide on it's error code. If I use
source name.sh
then if name.sh return non-zero return code my main script stop to run but I need to decide on exit code weather to continue or stop.
If I use
ret_code="`source name.sh`"
echo $ret_code
then ret_code is null and no error code is printed. I can't use these:
sh name.sh
./name.sh
bash name.sh
because name.sh is not executable and I don't want it to be executable
source name.sh
; this is equivalent tobash name.sh
(assuming $SHELL is bash). – msw May 21 '13 at 11:56