I am running a command through screen like this:
screen -d -m sh -c 'command'
The problem is that I would like to check if the command succeeded.
It seems that I can't do this with echo $?
.
http://savannah.gnu.org/bugs/?25611#postcomment
One way is to redirect the error to a file and check the file if it is empty.
screen -d -m sh -c 'invalid_command 2>error.txt'
Can you think of another way in order not to mess with files?