SUMMARY: rsh and exit codes

From: Browett, Darren (dbrowett@coquitlam.ca)
Date: Fri Apr 23 2004 - 11:43:18 EDT


Thanks to the following for their responses :

Steve Feehan
Mark Deiss
Tim Cutts
Dr Thomas Blinn
Jim Fitzmaurice
Alen Yokhanis

In Summary :
They all agreed that is the expected behaviour, and some of the comments
are :

1. The echo $? is showing the results of the rsh command. Not the
remotely executed command.
2. rsh has no built-in ability to return the exit code of a remote
command.
3. Use ssh, it does have the ability to return the exit code.
4. Modify the script such that it echos the exit code as opposed to
using the exit command.

And thank you to those that sent me example scripts.

Darren
-----Original Message-----

Hi Managers

I have a small script, exit_code.sh that has a "exit 1" in it.
If I run the command locally then do a echo $? I receive 1 (one) as the
answer.

But if I run it through rsh, then answer to echo $? is always zero.
(see script below)

Is that the expected behaviour ?

if it is, does anybody know of a way I can capture the exit code of a
remotely executed script.

Thanks

Darren

This is Tru64 5.1b, patch kit 3.

script to test exit code :

#!/bin/sh

for iHOST in trac1 trac2 ; do

rsh $iHOST "/ora/dba/sbin/exit_code.sh ; echo $?"

done



This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:49:57 EDT