<?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 Script Help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2719278#M62586</link>
    <description>command1 &amp;amp;&amp;amp; command2&lt;BR /&gt;&lt;BR /&gt;command 2 will only get executed if command 1 is successful. See man sh-posix for details.</description>
    <pubDate>Wed, 08 May 2002 08:27:26 GMT</pubDate>
    <dc:creator>Deepak Extross</dc:creator>
    <dc:date>2002-05-08T08:27:26Z</dc:date>
    <item>
      <title>Shell Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2719277#M62585</link>
      <description>Hi ,&lt;BR /&gt;&lt;BR /&gt;I have a shell script written , having 2 nos of commnads to execute. Here I have to define a condition for the execution so that if the first command is successful then only second will get executed.  &lt;BR /&gt;&lt;BR /&gt;Pl help !!!!&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 08 May 2002 08:22:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2719277#M62585</guid>
      <dc:creator>SSP_1</dc:creator>
      <dc:date>2002-05-08T08:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2719278#M62586</link>
      <description>command1 &amp;amp;&amp;amp; command2&lt;BR /&gt;&lt;BR /&gt;command 2 will only get executed if command 1 is successful. See man sh-posix for details.</description>
      <pubDate>Wed, 08 May 2002 08:27:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2719278#M62586</guid>
      <dc:creator>Deepak Extross</dc:creator>
      <dc:date>2002-05-08T08:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2719279#M62587</link>
      <description>Hi Sripad,&lt;BR /&gt;&lt;BR /&gt;Do something like this.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;command1&lt;BR /&gt;if [ $? -eq 0 ]&lt;BR /&gt;then&lt;BR /&gt;  command2&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 08 May 2002 08:28:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2719279#M62587</guid>
      <dc:creator>Sukant Naik</dc:creator>
      <dc:date>2002-05-08T08:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2719280#M62588</link>
      <description>Or you could try the more readable form:&lt;BR /&gt;command1&lt;BR /&gt;if [ $? -eq 0 ]&lt;BR /&gt;then &lt;BR /&gt;command2&lt;BR /&gt;fi</description>
      <pubDate>Wed, 08 May 2002 08:30:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2719280#M62588</guid>
      <dc:creator>Deepak Extross</dc:creator>
      <dc:date>2002-05-08T08:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2719281#M62589</link>
      <description>Another way is:-&lt;BR /&gt;&lt;BR /&gt;if command1&lt;BR /&gt;then command2&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;John</description>
      <pubDate>Wed, 08 May 2002 08:31:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2719281#M62589</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2002-05-08T08:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2719282#M62590</link>
      <description>Hi ,&lt;BR /&gt;&lt;BR /&gt;In "if [$# -eq 0] then" what does "0" corresponds? I believe it's "false" so doesn't this condition mean "if exit status of my previous commnad is "false" then execute second one". &lt;BR /&gt;&lt;BR /&gt;OR should I have to specify "1" instead of "0".</description>
      <pubDate>Wed, 08 May 2002 08:37:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2719282#M62590</guid>
      <dc:creator>SSP_1</dc:creator>
      <dc:date>2002-05-08T08:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2719283#M62591</link>
      <description>In unix, a return value of 0 indicates success. &lt;BR /&gt;So [ $? -eq 0 ] is a test of successful execuation of the preceding command.</description>
      <pubDate>Wed, 08 May 2002 08:38:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2719283#M62591</guid>
      <dc:creator>Deepak Extross</dc:creator>
      <dc:date>2002-05-08T08:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2719284#M62592</link>
      <description>Also have a look at this thread -&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x96b70bce6f33d6118fff0090279cd0f9,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x96b70bce6f33d6118fff0090279cd0f9,00.html&lt;/A&gt;</description>
      <pubDate>Wed, 08 May 2002 08:47:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2719284#M62592</guid>
      <dc:creator>Deepak Extross</dc:creator>
      <dc:date>2002-05-08T08:47:24Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2719285#M62593</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;this is very easy, you even don't need to test anything like return code:&lt;BR /&gt;&lt;BR /&gt;first_command &amp;amp;&amp;amp; second_command&lt;BR /&gt;&lt;BR /&gt;--&amp;gt; second command will only be executed, if first command has a return code value of zero&lt;BR /&gt;&lt;BR /&gt;first_command || second_command&lt;BR /&gt;&lt;BR /&gt;--&amp;gt; second command is only executed, if first command was not successful, has a return code not equal zero.&lt;BR /&gt;&lt;BR /&gt;If second command is executed later in the script, you have to put the return code of first command as value into a variable, cause return code is overwritten each time, a new command is executed:&lt;BR /&gt;&lt;BR /&gt;first_command&lt;BR /&gt;&lt;BR /&gt;var=`echo $?`&lt;BR /&gt;&lt;BR /&gt;Then, if the second command has to be executed, check out the return code of the first command:&lt;BR /&gt;&lt;BR /&gt;if [ $var -eq 0 ]&lt;BR /&gt;then&lt;BR /&gt;      second_command&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Allways stay on the bright side of life!&lt;BR /&gt;&lt;BR /&gt;Peter&lt;BR /&gt;</description>
      <pubDate>Wed, 08 May 2002 08:53:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2719285#M62593</guid>
      <dc:creator>Peter Kloetgen</dc:creator>
      <dc:date>2002-05-08T08:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2719286#M62594</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;u can check the success or failure of the command, include an echo statement.&lt;BR /&gt;&lt;BR /&gt;when a command successfully executes "echo $?" should show "0" else it shows "1".&lt;BR /&gt;&lt;BR /&gt;in ur case&lt;BR /&gt;&lt;BR /&gt;command1&lt;BR /&gt;if [ $? -eq 0 ]&lt;BR /&gt;then&lt;BR /&gt;command2&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;regds&lt;BR /&gt;ravi</description>
      <pubDate>Wed, 08 May 2002 08:59:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/2719286#M62594</guid>
      <dc:creator>V. V. Ravi Kumar_1</dc:creator>
      <dc:date>2002-05-08T08:59:16Z</dc:date>
    </item>
  </channel>
</rss>

