The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Exit Codes cmschube Shell Programming and Scripting 1 04-04-2008 08:34 AM
difference b/t the exit codes $* and $@ praveen_b744 Shell Programming and Scripting 1 09-19-2007 06:53 AM
Explanation for the exit codes 2 sesedada UNIX for Advanced & Expert Users 1 06-24-2006 11:31 PM
Where can I find a list of exit codes? (Exit code 64) jkuchar747 UNIX for Dummies Questions & Answers 3 12-07-2004 03:08 PM
exit codes donna carter High Level Programming 3 05-31-2001 06:35 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 08-12-2005
Registered User
 

Join Date: Aug 2005
Posts: 2
exit codes from rexec?

how do i/is there a way to return the exit code from the remote host?
echo $? from the local host only gives 0, if the rexec command itself executes successfully. But what if in the case of the remote command failiing? echo $? on the localhost still gives 0, but I'm interested in the exit code from the failing command on the REMOTE host...
Reply With Quote
Forum Sponsor
  #2  
Old 08-12-2005
reborg's Avatar
Administrator
 

Join Date: Mar 2005
Location: Ireland
Posts: 3,642
On the remote host echo the exit code after the command has completed and use that on the localhost by using tail -1 on the output of the rexec command.
Reply With Quote
  #3  
Old 08-16-2005
Registered User
 

Join Date: Aug 2005
Posts: 2
Unhappy

hi reborg and all,
i tried that and it still returns 0. i even rexec'ed a nonsense command (something like "lsdflkjfd" - which I'm sure doesn't do anything...) and the echo $?, as in:

rexec server1 "lsdflkjfd; echo $?"
i log in with username and password, and it echoes back:

ksh: lsdflkjfd: not found.
0

It still returns 0!!!
Reply With Quote
  #4  
Old 08-16-2005
reborg's Avatar
Administrator
 

Join Date: Mar 2005
Location: Ireland
Posts: 3,642
Single quotes otherwise the shell will expand $?

Here is what I get:
Code:
# rexec aserver 'dummy; echo $?'
ksh: dummy:  not found
127
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:54 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0