I am trying to get the return value from a java program ( System.exit(1);
) into a shell script, but it seems like its returning the jvm exit code, which is always 0, if it doesnt crash. For testing purposes, this is the very first line in my main().
Anyone know how to do this?
My bash code:
java bsc/cdisc/ImportData $p $e $t
#-----------------------------------------
# CATCH THE VALUE OF ${?} IN VARIABLE 'STATUS'
# STATUS="${?}"
# ---------------------------------------
STATUS="${?}"
# return to parent directory
cd ../scripts
echo "${STATUS}"
Thanks