From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Browett, Darren" Newsgroups: gmane.os.tru64.managers Subject: SUMMARY: rsh and exit codes Date: Fri, 23 Apr 2004 08:43:18 -0700 Sender: tru64-unix-managers-owner@ornl.gov Message-ID: <8423DAC11EF82D469CF20CE341CC4EDF02C9322A@EXCHANGE.private.coquitlam.bc.ca> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1082735043 17342 80.91.224.253 (23 Apr 2004 15:44:03 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 23 Apr 2004 15:44:03 +0000 (UTC) Original-X-From: tru64-unix-managers-owner-gotm-tru64-unix-managers=m.gmane.org@sws1.ctd.ornl.gov Fri Apr 23 17:43:41 2004 Return-path: Original-Received: from sws1.ornl.gov ([160.91.1.101]) by deer.gmane.org with smtp (Exim 3.35 #1 (Debian)) id 1BH2q2-00087B-00 for ; Fri, 23 Apr 2004 17:43:38 +0200 Original-Received: (qmail 21920 invoked by uid 5); 23 Apr 2004 15:43:30 -0000 Original-Followup-To: poster Precedence: bulk Original-Received: (qmail 21905 invoked by uid 49501); 23 Apr 2004 15:43:30 -0000 Original-Received: from dbrowett@coquitlam.ca by sws1 by uid 49491 with qmail-scanner-1.21 (clamdscan: 0.70-rc. iscan: v3.1/v5.600-1011/847/50540. spamassassin: 2.63. Clear:RC:0(160.91.86.17):SA:0(-4.9/5.0):. Processed in 0.556408 secs); 23 Apr 2004 15:43:30 -0000 Original-Received: from unknown (HELO emroute2.cind.ornl.gov) (160.91.86.17) by 0 with SMTP; 23 Apr 2004 15:43:29 -0000 Original-Received: from emroute2.cind.ornl.gov (LOCALHOST [127.0.0.1]) by emroute2.cind.ornl.gov (PMDF V6.2-X27 #30899) with ESMTP id <0HWM003J0ROFH1@emroute2.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Fri, 23 Apr 2004 11:43:28 -0400 (EDT) Original-Received: from VIRUSCAN-DAEMON.emroute2.cind.ornl.gov by emroute2.cind.ornl.gov (PMDF V6.2-X27 #30899) id <0HWM00B02RO820@emroute2.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Fri, 23 Apr 2004 11:43:21 -0400 (EDT) Original-Received: from EXCHANGE.private.coquitlam.bc.ca ([142.219.32.70]) by emroute2.cind.ornl.gov (PMDF V6.2-X27 #30899) with ESMTP id <0HWM005IPRO7F2@emroute2.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Fri, 23 Apr 2004 11:43:20 -0400 (EDT) Original-To: Tru64-Unix-Managers X-MIMEOLE: Produced By Microsoft Exchange V6.0.6249.0 Thread-Topic: SUMMARY: rsh and exit codes Thread-Index: AcQouWERjQa9iezTRdmV85HOzsSdyAAjqEXg content-class: urn:content-classes:message X-MS-Has-Attach: X-MS-TNEF-Correlator: Xref: main.gmane.org gmane.os.tru64.managers:6855 X-Report-Spam: http://spam.gmane.org/gmane.os.tru64.managers:6855 Thanks to the following for their responses : Steve Feehan Mark Deiss Tim Cutts=20 Dr Thomas Blinn Jim Fitzmaurice Alen Yokhanis In Summary : They all agreed that is the expected behaviour, and some of the comments are :=20 1. The echo $? is showing the results of the rsh command. Not the remotely executed command. =20 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 ?=20 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