I\'m trying to call a custom shell script through sh:
sh
/bin/sh -c \'myscript.sh` >log.txt 2>&1 & echo $!
Output of th
echo $? >> /path/to/return_code
$? has the return code of the last statement in bash.
(/bin/sh -c "myscript.sh" >log.txt 2>&1 ; echo $? >somefile) & echo $!
( /bin/sh -c 'myscript.sh` >log.txt 2>&1 echo $? > some_file ) &