<?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: Shell scripting in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2942808#M930359</link>
    <description>Hi&lt;BR /&gt;&lt;BR /&gt;exit status is 0 because it's the exit status of the remsh command and this command works fine&lt;BR /&gt;&lt;BR /&gt;Try this&lt;BR /&gt;&lt;BR /&gt;remsh &lt;HOSTNAME&gt; -n "grep "string" /etc/hosts; echo \$?"&lt;BR /&gt;&lt;BR /&gt;Chris&lt;BR /&gt;&lt;/HOSTNAME&gt;</description>
    <pubDate>Thu, 03 Apr 2003 08:36:13 GMT</pubDate>
    <dc:creator>Christian Gebhardt</dc:creator>
    <dc:date>2003-04-03T08:36:13Z</dc:date>
    <item>
      <title>Shell scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2942807#M930358</link>
      <description>Hi i am a beginner in shell scripting,I was trying to run a script written by me using remsh command,the command looks like this&lt;BR /&gt;remsh &lt;REMOTEHOST&gt; -n grep "string" /etc/hosts&lt;BR /&gt;the string which i am looking for does not exist in the remote host,but still the exit status of the command is 0(success)..how is it possible?is there any other way to do this,kindly let me know.thanx in advance&lt;/REMOTEHOST&gt;</description>
      <pubDate>Thu, 03 Apr 2003 08:28:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2942807#M930358</guid>
      <dc:creator>dhrtrth</dc:creator>
      <dc:date>2003-04-03T08:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: Shell scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2942808#M930359</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;exit status is 0 because it's the exit status of the remsh command and this command works fine&lt;BR /&gt;&lt;BR /&gt;Try this&lt;BR /&gt;&lt;BR /&gt;remsh &lt;HOSTNAME&gt; -n "grep "string" /etc/hosts; echo \$?"&lt;BR /&gt;&lt;BR /&gt;Chris&lt;BR /&gt;&lt;/HOSTNAME&gt;</description>
      <pubDate>Thu, 03 Apr 2003 08:36:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2942808#M930359</guid>
      <dc:creator>Christian Gebhardt</dc:creator>
      <dc:date>2003-04-03T08:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: Shell scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2942809#M930360</link>
      <description>Hi,&lt;BR /&gt;The remsh commands succeds (and returns 0) this has no relation to the remote command. Have a look at man page for remsh.</description>
      <pubDate>Thu, 03 Apr 2003 08:39:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2942809#M930360</guid>
      <dc:creator>Leif Halvarsson_2</dc:creator>
      <dc:date>2003-04-03T08:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: Shell scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2942810#M930361</link>
      <description>The 0 return you are getting is the result of the remsh command (which completed successfully). If you restructure your command so that you "cat /etc/hosts" on the remote machine then pipe the result to a local grep eg:&lt;BR /&gt;remsh &lt;REMOTEHOST&gt; -n cat /etc/hosts | grep "string"&lt;BR /&gt;then $? will contain the result of the grep (as the last command in the line) not the remsh.&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;Stephen&lt;/REMOTEHOST&gt;</description>
      <pubDate>Thu, 03 Apr 2003 08:45:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2942810#M930361</guid>
      <dc:creator>Stephen Burkwood</dc:creator>
      <dc:date>2003-04-03T08:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: Shell scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2942811#M930362</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;See the return value part from man page:&lt;BR /&gt;&lt;BR /&gt;RETURN VALUE&lt;BR /&gt;      If remsh fails to set up the secondary socket connection, it returns&lt;BR /&gt;      2.  If it fails in some other way, it returns 1.  If it fully succeeds&lt;BR /&gt;      in setting up a connection with remshd, it returns 0 once the remote&lt;BR /&gt;      command has completed.  Note that the return value of remsh bears no&lt;BR /&gt;      relation to the return value of the remote command.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;DR</description>
      <pubDate>Thu, 03 Apr 2003 18:01:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2942811#M930362</guid>
      <dc:creator>Dario_1</dc:creator>
      <dc:date>2003-04-03T18:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: Shell scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2942812#M930363</link>
      <description>Try&lt;BR /&gt;&lt;BR /&gt;remsh &lt;SVR&gt; -n "egrep string /etc/hosts &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 ; echo $?"&lt;BR /&gt;&lt;BR /&gt;This will return the RC from the grep... In ksh you can further refine this&lt;BR /&gt;&lt;BR /&gt;RC=$(remsh &lt;SVR&gt; -n "egrep string /etc/hosts &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 ; echo $?")&lt;BR /&gt;echo $RC&lt;BR /&gt;&lt;BR /&gt;Now you have the RC from the remote egrep.&lt;BR /&gt;&lt;BR /&gt;Tim&lt;/SVR&gt;&lt;/SVR&gt;</description>
      <pubDate>Thu, 03 Apr 2003 19:22:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2942812#M930363</guid>
      <dc:creator>Tim D Fulford</dc:creator>
      <dc:date>2003-04-03T19:22:19Z</dc:date>
    </item>
  </channel>
</rss>

