LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How do I check the exit status of a remote command? (https://www.linuxquestions.org/questions/linux-general-1/how-do-i-check-the-exit-status-of-a-remote-command-721443/)

Ronayn 04-24-2009 12:39 PM

How do I check the exit status of a remote command?
 
I am working on a bash script that will execute commands on remote computers using rsh. rsh itself returns an exit code, which I can access by echoing $?. But what I want is the exit code of the command that I remotely executed. Is there a way to get at this?

TIA
Thom

unSpawn 04-25-2009 04:59 AM

I don't use Rsh (are you sure you should?) but how about just echoing "$?" as in 'RETVAL=$(ssh user@host '/bin/false >/dev/null; echo $?'); echo $RETVAL'?


All times are GMT -5. The time now is 12:32 AM.