<?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 condition statement in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-condition-statement/m-p/3565765#M227296</link>
    <description>You can do it as,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;if [[ ${BACKUP_RC} -eq 0 || ${BACKUP_RC} -eq 4 ]]&lt;BR /&gt;then&lt;BR /&gt;   statments;&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;hth.&lt;BR /&gt;</description>
    <pubDate>Thu, 16 Jun 2005 23:49:01 GMT</pubDate>
    <dc:creator>Muthukumar_5</dc:creator>
    <dc:date>2005-06-16T23:49:01Z</dc:date>
    <item>
      <title>Shell script condition statement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-condition-statement/m-p/3565762#M227293</link>
      <description>Hello.  Simple question I hope.  I want to test my backup_rc for 0 or 4 after a backup.  Currently my script tests for 0 like so:&lt;BR /&gt;"if [ $BACKUP_RC -eq 0 ] then"&lt;BR /&gt;How do I incorporate an OR into it, syntax-wise?&lt;BR /&gt;&lt;BR /&gt;Thanks much,&lt;BR /&gt;Damian</description>
      <pubDate>Thu, 16 Jun 2005 21:18:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-condition-statement/m-p/3565762#M227293</guid>
      <dc:creator>Damian Gardner</dc:creator>
      <dc:date>2005-06-16T21:18:02Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script condition statement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-condition-statement/m-p/3565763#M227294</link>
      <description>if [ $BACKUP_RC -eq 0 -o $BACKUP_RC -eq 4 ]; then&lt;BR /&gt;...</description>
      <pubDate>Thu, 16 Jun 2005 21:46:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-condition-statement/m-p/3565763#M227294</guid>
      <dc:creator>Ermin Borovac</dc:creator>
      <dc:date>2005-06-16T21:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script condition statement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-condition-statement/m-p/3565764#M227295</link>
      <description>HI Damian,&lt;BR /&gt;&lt;BR /&gt;you can use logical operators say e.g&lt;BR /&gt;if [ $BACKUP_RC -eq 0 || $BACKUP -eq 1 ] then ...&lt;BR /&gt;&lt;BR /&gt;try this&lt;BR /&gt;&lt;BR /&gt;Cheers !!!&lt;BR /&gt;eknath</description>
      <pubDate>Thu, 16 Jun 2005 22:01:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-condition-statement/m-p/3565764#M227295</guid>
      <dc:creator>Eknath</dc:creator>
      <dc:date>2005-06-16T22:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script condition statement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-condition-statement/m-p/3565765#M227296</link>
      <description>You can do it as,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;if [[ ${BACKUP_RC} -eq 0 || ${BACKUP_RC} -eq 4 ]]&lt;BR /&gt;then&lt;BR /&gt;   statments;&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;hth.&lt;BR /&gt;</description>
      <pubDate>Thu, 16 Jun 2005 23:49:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-condition-statement/m-p/3565765#M227296</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-06-16T23:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script condition statement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-condition-statement/m-p/3565766#M227297</link>
      <description>Operators (increasing precedence) &lt;BR /&gt;        =   +=   -=   *=   /=   %=   ^=         assignment &lt;BR /&gt;        ?:                                      conditional expression &lt;BR /&gt;        ||                                      logical or &lt;BR /&gt;        &amp;amp; &amp;amp;                                     logical and &lt;BR /&gt;        ~   !~                                  regular expression match, negated match &lt;BR /&gt;        &amp;lt;    &amp;lt; =   &amp;gt;    &amp;gt; =   !=   ==           relationals &lt;BR /&gt;        blank                                   string concatenation &lt;BR /&gt;        +   -                                   add, subtract &lt;BR /&gt;        *   /   %                               multiply, divide, modulus &lt;BR /&gt;        +   -   !                               unary plus, unary minus, logical negation &lt;BR /&gt;        ^                                       exponentional &lt;BR /&gt;        ++   --                                 increment, decrement &lt;BR /&gt;        $                                       field &lt;BR /&gt;</description>
      <pubDate>Fri, 17 Jun 2005 00:56:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-condition-statement/m-p/3565766#M227297</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2005-06-17T00:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script condition statement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-condition-statement/m-p/3565767#M227298</link>
      <description>Hi,&lt;BR /&gt;if you only expect 0 or 4 you already have good answers. However, it is good practice to double quote variables in order to avoid syntax errors in case a variable is not expanded.&lt;BR /&gt;If you expect a wider diversity of return values, you could use a case statement, e.g.:&lt;BR /&gt;&lt;BR /&gt;case  "$BACKUP_RC" in&lt;BR /&gt;  0) echo the returncode was 0;;&lt;BR /&gt;  1) echo the returncode was 1;;&lt;BR /&gt;  4) echo the returncode was 4;;&lt;BR /&gt;  *) echo the returncode was completely unexpected;;&lt;BR /&gt;esac&lt;BR /&gt; &lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Fri, 17 Jun 2005 01:47:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-condition-statement/m-p/3565767#M227298</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2005-06-17T01:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script condition statement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-condition-statement/m-p/3565768#M227299</link>
      <description>Hi Damian,&lt;BR /&gt;&lt;BR /&gt;Another possibility is the shell built-in "case". That is faster (because it's a shell built-in) and more readeble. &lt;BR /&gt;&lt;BR /&gt;The syntax would look like:&lt;BR /&gt;case ${BACKUP_RC} in&lt;BR /&gt;0)&lt;BR /&gt; echo "BACKUP_RC is 0"&lt;BR /&gt;;;&lt;BR /&gt;1)&lt;BR /&gt; echo "BACKUP_RC is 1"&lt;BR /&gt;;;&lt;BR /&gt;*&lt;BR /&gt; echo "BACKUP_RC is ${BACKUP_RC}"&lt;BR /&gt;;;&lt;BR /&gt;esac&lt;BR /&gt;Hope that helps!&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Renarios</description>
      <pubDate>Fri, 17 Jun 2005 02:13:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-condition-statement/m-p/3565768#M227299</guid>
      <dc:creator>renarios</dc:creator>
      <dc:date>2005-06-17T02:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script condition statement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-condition-statement/m-p/3565769#M227300</link>
      <description>if [ $backup eq 1 ] ||  [ $backup eq 2 ] || [ $backup eq 3 ] || [ $backup eq 4] ; then&lt;BR /&gt;  echo " do something "&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 17 Jun 2005 08:16:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-condition-statement/m-p/3565769#M227300</guid>
      <dc:creator>Basheer_2</dc:creator>
      <dc:date>2005-06-17T08:16:00Z</dc:date>
    </item>
  </channel>
</rss>

