LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 04-24-2009, 12:39 PM   #1
Ronayn
Member
 
Registered: Jan 2006
Posts: 55

Rep: Reputation: 0
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
 
Old 04-25-2009, 04:59 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,470
Blog Entries: 54

Rep: Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901
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'?
 
1 members found this post helpful.
  


Reply

Tags
bash, exit status, script


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error: command 'gcc' failed with exit status 1 yuri16 Linux - Software 1 04-21-2009 01:27 AM
how to check for exit status of a command in one scriptA ,from another scriptB? wrapster Solaris / OpenSolaris 8 07-05-2008 12:12 PM
FSCK Check forced - Exit Status 4 sandoz Linux - Software 12 01-24-2008 06:55 PM
Exit status of system command?? rmvinodh123 Programming 4 05-04-2007 11:15 AM
Bash command exit status humbletech99 Programming 12 07-06-2006 12:20 PM


All times are GMT -5. The time now is 01:11 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration