Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RSH return value

Status
Not open for further replies.

Muskaan

Programmer
Oct 21, 2002
47
0
0
US
Hi All,

I wanted to find out a way to get a return value of a command run by rsh. eg: rsh -l<login> <machine name> <command>

Is there a way to determine whether <command> running on remote machine returned 0 or 1 ?

I tried
$> rsh -l<login> <machine name> &quot;<command>; echo $?&quot;
but it always echos 0 (success).

Help!
Muskaan
 
have you tried creating a wrap around script on the remote machine to do some result checking?
 
The $? will return 0 or 1 depending on the success or failure of the rsh, not the command(s) passed with it.
If you rsh to a server that doesn't exist, and echo $? you'd get 1 returned.

Dickie Bird (:)-)))
 
When writing scripts that use rsh, it is critical that you use the
Code:
-n
parameter, otherwise it simply swallows the output.

--
Andy
&quot;Historically speaking, the presence of wheels in Unix has never precluded their reinvention.&quot;
Larry Wall
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top