Getting exit status for a command completed by rsh.

Getting exit status for a command completed by rsh.

Post by Phillip Johnso » Tue, 01 Oct 2002 18:32:47



Hi,

Does anybody have a good clean method for getting the exit status of a
command run by rsh?.

( BTW, SunOS 5.6 )

TIA,

Phillip.

 
 
 

Getting exit status for a command completed by rsh.

Post by Joe Blogg » Tue, 01 Oct 2002 20:47:49



Quote:> Hi,

> Does anybody have a good clean method for getting the exit status of a
> command run by rsh?.

> ( BTW, SunOS 5.6 )

> TIA,

> Phillip.

Use :-
rsh host "command ; echo "RC=$?"'
...and then parse the output.

Or use the ersh script :-
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=3A09...
2E7874%40labs.mot.com

 
 
 

Getting exit status for a command completed by rsh.

Post by James Carlso » Wed, 02 Oct 2002 03:39:11



> Does anybody have a good clean method for getting the exit status of a
> command run by rsh?.

The protocol itself doesn't actually support that.  About the best
(hack) that you can do is look for output on stderr and interpret that
as being a non-zero exit status.

--

SUN Microsystems / 1 Network Drive         71.234W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.497N   Fax +1 781 442 1677

 
 
 

1. rsh - getting the status of an rsh'd command

Within a csh script, I am trying to determine whether a directory
exists on a remote machine. I've tried

        rsh remoteHost "(test -d someDirectory; echo $status)"

But as long as the rsh itself is successful this always echoes 0.
I've also tried

        rsh remoteHost "if (-d someDirectory) touch /usr/tmp/tmpfile"

hoping that it will create a local file as a flag, but this simply
ends up creating the file on the remote host.

There is probably a simple solution which I hope all the expert
shell programmers out there will point out to me.

Thanks
Cecelia

2. Printer on Linux box prints extra page VIA samba!

3. How to get the exit status of a remote command executed via rsh

4. Q: select() returns upon socket connection, or STDIN, but not both

5. how to force rsh to exit with status of remote command

6. AMD K5 processor... Any pointers?

7. best practice for getting exit status of pipeline commands (bash, ksh, etc)

8. Hard disk on 2nd IDE port

9. Test exit status of command prior to last command

10. ersh - rsh frontend hack returning exit status of remote cmd

11. exit status using rsh

12. getting status from first command in a piped command line

13. rsh exit status