Antwort: Re: rsh and return code

From: fmu@OERAG.DE
Date: Wed Nov 06 2002 - 07:39:52 EST


Thanks,
            this works : - ))))

Frank Mueller

-------------------------------------------------------
| OERAG Rechtsschutzversicherungs AG |
| Hansaallee 199 , D - 40549 Duesseldorf |
| |
| Dipl.-Physik Ing. Frank Mueller |
| IBM Certified Specialist - AIX |
| Fachverantwortlicher UNIX Systems |
| OERAG IT , Rechenzentrum |
| |
| http://www.oerag.com |
| |
-------------------------------------------------------

Of course you can get this to work .... this is UNIX after all :-)

The problem is that because of the double quotes the local system is
evaluating the "$?" BEFORE you send it to the remote host. What you're
actually doing is: remsh rhost "date; echo 0"

So of course it always returns a zero.

To get this to work you can...

Use single quotes:

    remsh rhost 'date; echo $?'

or use double quotes and escape the dollar sign:

    remsh rhost "date; echo \$?"

examples:

-> remsh node5t1 'date; echo $?'
Wed Nov 6 07:21:13 EST 2002
0

-> remsh node5t1 'datkdajfk; echo $?'
ksh: datkdajfk: not found.
127

-> dsh -w node5t1 "datkdajfk; echo \$?"
hqgbi5t1: 127
hqgbi5t1: ksh: datkdajfk: not found.

Bill Thompson
Sr UNIX Systems Administrator
The Goodyear Tire & Rubber Co.

Contains Confidential and/or Proprietary Information
May Not Be Copied or Disseminated Without Express Consent of The Goodyear
Tire & Rubber Company.



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:18 EDT