How do I check the exit status of a remote command

How do I check the exit status of a remote command


This doesn't work:

rsh some-machine some-crummy-command || echo "Command failed"

The exit status of 'rsh' is 0 (success) if the rsh program
itself completed successfully, which probably isn't what
you wanted.

If you want to check on the exit status of the remote program,
you can try using Maarten Litmaath's 'ersh' script, which was
posted to alt.sources in October 1994. ersh is a shell script
that calls rsh, arranges for the remote machine to echo the
status of the command after it completes, and exits with that
status.



Home FAQ