<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: read exit code in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/read-exit-code/m-p/3193948#M791968</link>
    <description>Very thanks at all!!!&lt;BR /&gt;&lt;BR /&gt;Finally solution is:&lt;BR /&gt;&lt;BR /&gt;remsh nmcmds11 '/opt/OV/bin/ecsmgr -i 3 -info &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 ; remsh nmcmds11 echo $?'&lt;BR /&gt;&lt;BR /&gt;Hi.&lt;BR /&gt;</description>
    <pubDate>Tue, 17 Feb 2004 07:59:00 GMT</pubDate>
    <dc:creator>Adam_116</dc:creator>
    <dc:date>2004-02-17T07:59:00Z</dc:date>
    <item>
      <title>read exit code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read-exit-code/m-p/3193944#M791964</link>
      <description>Hi,&lt;BR /&gt;i want read exit code for command "remsh &lt;SERVER&gt; ecsmgr -i 3 -info".&lt;BR /&gt;Next I have try typing "remsh &lt;SERVER&gt; echo $?" but result is always "0".&lt;BR /&gt;Please help me.&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;/SERVER&gt;&lt;/SERVER&gt;</description>
      <pubDate>Tue, 17 Feb 2004 07:41:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read-exit-code/m-p/3193944#M791964</guid>
      <dc:creator>Adam_116</dc:creator>
      <dc:date>2004-02-17T07:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: read exit code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read-exit-code/m-p/3193945#M791965</link>
      <description>Try doing a,&lt;BR /&gt;&lt;BR /&gt;"remsh &lt;SERVER&gt; ecsmgr -i 3 -info; echo $?"&lt;BR /&gt;&lt;BR /&gt;-Karthik S S&lt;/SERVER&gt;</description>
      <pubDate>Tue, 17 Feb 2004 07:44:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read-exit-code/m-p/3193945#M791965</guid>
      <dc:creator>Karthik S S</dc:creator>
      <dc:date>2004-02-17T07:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: read exit code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read-exit-code/m-p/3193946#M791966</link>
      <description>You need to do it like this!&lt;BR /&gt; &lt;BR /&gt;EXITCODE=`remsh &lt;SERVER&gt; 'echo $?'`&lt;BR /&gt; &lt;BR /&gt;However, this will be a problem if you have more output than just the exit code.&lt;/SERVER&gt;</description>
      <pubDate>Tue, 17 Feb 2004 07:46:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read-exit-code/m-p/3193946#M791966</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-02-17T07:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: read exit code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read-exit-code/m-p/3193947#M791967</link>
      <description>What you need to do is.&lt;BR /&gt;&lt;BR /&gt;remesh &lt;SERVER&gt; scriptname&lt;BR /&gt;&lt;BR /&gt;The script looks like this:&lt;BR /&gt;&lt;BR /&gt;escmgr -i 3 -info&lt;BR /&gt;rc=$?&lt;BR /&gt;if [ $rc -ne 0 ]&lt;BR /&gt;then&lt;BR /&gt;   echo "Bad Script $rc"&lt;BR /&gt;else&lt;BR /&gt;   echo "Good Script"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;return $rc&lt;BR /&gt;&lt;BR /&gt;This will at least be able to act on the error code and might return the code you want(probably not)&lt;BR /&gt;&lt;BR /&gt;The 0 you are getting back is for the remesh command. That has been successful.&lt;BR /&gt;&lt;BR /&gt;Try remesh for a server that does not exist. That will give you a non-zero error code.&lt;BR /&gt;&lt;BR /&gt;SEP&lt;/SERVER&gt;</description>
      <pubDate>Tue, 17 Feb 2004 07:46:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read-exit-code/m-p/3193947#M791967</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-02-17T07:46:44Z</dc:date>
    </item>
    <item>
      <title>Re: read exit code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read-exit-code/m-p/3193948#M791968</link>
      <description>Very thanks at all!!!&lt;BR /&gt;&lt;BR /&gt;Finally solution is:&lt;BR /&gt;&lt;BR /&gt;remsh nmcmds11 '/opt/OV/bin/ecsmgr -i 3 -info &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 ; remsh nmcmds11 echo $?'&lt;BR /&gt;&lt;BR /&gt;Hi.&lt;BR /&gt;</description>
      <pubDate>Tue, 17 Feb 2004 07:59:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read-exit-code/m-p/3193948#M791968</guid>
      <dc:creator>Adam_116</dc:creator>
      <dc:date>2004-02-17T07:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: read exit code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read-exit-code/m-p/3193949#M791969</link>
      <description>Adam,&lt;BR /&gt;&lt;BR /&gt;Did you test your solution thoroughly? I assume there's a typo in it with you apostrophes and that you are issuing 2 remsh commands. &lt;BR /&gt;&lt;BR /&gt;I don't see why the second remsh will report the first's exit code. There is no relationship between these two commands, from the nmcmds11's point of view.&lt;BR /&gt;&lt;BR /&gt;What the other replies try to tell you is that you must distinguish between the exit code of the remsh itself, and the exit code of the command executed on the remote server.&lt;BR /&gt;That's why they suggest to generate some output that can be interpreted on the machine that starts the remsh commands.&lt;BR /&gt;&lt;BR /&gt;JP.&lt;BR /&gt;</description>
      <pubDate>Tue, 17 Feb 2004 08:08:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read-exit-code/m-p/3193949#M791969</guid>
      <dc:creator>Jeroen Peereboom</dc:creator>
      <dc:date>2004-02-17T08:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: read exit code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read-exit-code/m-p/3193950#M791970</link>
      <description>I think Jeroen is right: there is no relationship between the echo and the first remote shell commando. What you should do is combine them.&lt;BR /&gt;&lt;BR /&gt;For instance: remsh &lt;SERVER&gt; 'ecsmgr -i 3 -info ; echo $?'&lt;BR /&gt;&lt;BR /&gt;&lt;/SERVER&gt;</description>
      <pubDate>Tue, 17 Feb 2004 09:36:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read-exit-code/m-p/3193950#M791970</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2004-02-17T09:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: read exit code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read-exit-code/m-p/3193951#M791971</link>
      <description>Hi,&lt;BR /&gt;Jeroen is right and if i type 2 remsh consecutive result exit code is not correct.&lt;BR /&gt;Just solved problem whith this strings:&lt;BR /&gt;$ECS_STATUS = `remsh $SERVER '/opt/OV/bin/ecsmgr -i 3 -info &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 ; echo \$?'`;&lt;BR /&gt;&lt;BR /&gt;The symbol "\" before "$?" does not allow the program to interpret "$?" like local variable but like remote variable.&lt;BR /&gt;&lt;BR /&gt;Bye</description>
      <pubDate>Tue, 17 Feb 2004 12:19:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read-exit-code/m-p/3193951#M791971</guid>
      <dc:creator>Adam_116</dc:creator>
      <dc:date>2004-02-17T12:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: read exit code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read-exit-code/m-p/3193952#M791972</link>
      <description>Adam&lt;BR /&gt;&lt;BR /&gt;Please assign point to answers if they were helpful.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/helptips.do?#22" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/helptips.do?#22&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Paula&lt;BR /&gt;</description>
      <pubDate>Tue, 17 Feb 2004 12:26:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read-exit-code/m-p/3193952#M791972</guid>
      <dc:creator>Paula J Frazer-Campbell</dc:creator>
      <dc:date>2004-02-17T12:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: read exit code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read-exit-code/m-p/3193953#M791973</link>
      <description>This is another reason to install and use secure shell rather than remsh.  Secure shell returns the exit code properly from the remotely executed code.  This is handy for testing the outcome of commands without going through a lot gyrations to capture it.  &lt;BR /&gt;Secure shell is free.  Install it as you do any depot.  I've attached my usual file that describes how to configure it so that it doesn't challenge for passwords.  Here is an example:&lt;BR /&gt;&lt;BR /&gt;# ssh DESTHOST "ls -l /etc/hots"&lt;BR /&gt;# echo "$?"&lt;BR /&gt;2&lt;BR /&gt;#&lt;BR /&gt;#ssh DESTHOST "ls -l /etc/hosts"&lt;BR /&gt;#echo "$?"&lt;BR /&gt;0&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;Good luck&lt;BR /&gt;Chris</description>
      <pubDate>Tue, 17 Feb 2004 13:34:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read-exit-code/m-p/3193953#M791973</guid>
      <dc:creator>Chris Vail</dc:creator>
      <dc:date>2004-02-17T13:34:54Z</dc:date>
    </item>
  </channel>
</rss>

