I have a long-running command that I've been running in
screen so as to be able to interact with it when it encounters bugs. But I'd also like to be able to start it via another shell script (which achieves something similar to GNU parallel), so I've been using
screen -m -D mycommand which works quite well, except that I can't seem to figure out how to get the exit status - which is important for restarting jobs that have failed.
Is there a way to get
screen to return the exit status of its child process? Just to have a test case to play with:
screen -mD sh -c "exit 1" echo $? # prints 0; would like something that prints 1