<?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: Test Condition in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/test-condition/m-p/5055652#M747293</link>
    <description>Okay - it concludes that if $? != 0 means failed.&lt;BR /&gt;&lt;BR /&gt;Also, what is the meaning of writing 2&amp;gt;&amp;amp;1 i have seen in end of some commands.</description>
    <pubDate>Fri, 29 Jun 2007 06:38:47 GMT</pubDate>
    <dc:creator>panchpan</dc:creator>
    <dc:date>2007-06-29T06:38:47Z</dc:date>
    <item>
      <title>Test Condition</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-condition/m-p/5055648#M747289</link>
      <description>Could you please let me know the difference between [[ $? != 0 ]] and [ $? != 0 ]&lt;BR /&gt;&lt;BR /&gt;Normally, I believe IF $? is not equal to 0 means - success.&lt;BR /&gt;&lt;BR /&gt;Correct me if i am wrong.&lt;BR /&gt;</description>
      <pubDate>Fri, 29 Jun 2007 06:16:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-condition/m-p/5055648#M747289</guid>
      <dc:creator>panchpan</dc:creator>
      <dc:date>2007-06-29T06:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Test Condition</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-condition/m-p/5055649#M747290</link>
      <description>no, if $? equals 0 it means success.&lt;BR /&gt;&lt;BR /&gt;look at this example:&lt;BR /&gt;$ cd /etc; echo $?&lt;BR /&gt;0&lt;BR /&gt;$ cd /nirvana; echo $?&lt;BR /&gt;su: /nirvana:  not found.&lt;BR /&gt;1&lt;BR /&gt;</description>
      <pubDate>Fri, 29 Jun 2007 06:24:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-condition/m-p/5055649#M747290</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2007-06-29T06:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: Test Condition</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-condition/m-p/5055650#M747291</link>
      <description>This single brackets is documented under test(1).  And you have a slight error in it.  $? is an integer, you are doing a string compare with "0", while this will work, the correct form is:  [ $? -ne 0 ]&lt;BR /&gt;&lt;BR /&gt;The double bracket form is a ksh/Posix shell new feature. What you are doing there is even more wrong.  You are doing pattern matching of an integer with a string.  This just happens to work again.&lt;BR /&gt;&lt;BR /&gt;Also "Word splitting and file name generation are not" are not done in [[]].&lt;BR /&gt;&lt;BR /&gt;It also has more conditions and you can use || and &amp;amp;&amp;amp; to combine conditions.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I believe IF $? is not equal to 0 means - success.&lt;BR /&gt;&lt;BR /&gt;Yes but you should use -ne instead.</description>
      <pubDate>Fri, 29 Jun 2007 06:25:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-condition/m-p/5055650#M747291</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-06-29T06:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: Test Condition</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-condition/m-p/5055651#M747292</link>
      <description>&amp;gt;I believe IF $? is not equal to 0 means - success.&lt;BR /&gt;&lt;BR /&gt;Oops, as Oviwan says, I got it backwards.</description>
      <pubDate>Fri, 29 Jun 2007 06:26:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-condition/m-p/5055651#M747292</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-06-29T06:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: Test Condition</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-condition/m-p/5055652#M747293</link>
      <description>Okay - it concludes that if $? != 0 means failed.&lt;BR /&gt;&lt;BR /&gt;Also, what is the meaning of writing 2&amp;gt;&amp;amp;1 i have seen in end of some commands.</description>
      <pubDate>Fri, 29 Jun 2007 06:38:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-condition/m-p/5055652#M747293</guid>
      <dc:creator>panchpan</dc:creator>
      <dc:date>2007-06-29T06:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: Test Condition</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-condition/m-p/5055653#M747294</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;A single-bracket expression calls the test(1) command, while a double-bracket expression uses the shell's built-in evaluation.  A double-bracket expression supports wildcards and more operators than the single-bracket version.  Perhaps most notably, with double brackets, "&amp;amp;&amp;amp;" and "||" may be used in place of "-a" and "-o".&lt;BR /&gt;&lt;BR /&gt;On any UNIX and UNIX-like platform, an exit status (${?}) of zero indicates success.  Conversely, a non-zero exit status usually indicates failure.&lt;BR /&gt;&lt;BR /&gt;PCS</description>
      <pubDate>Fri, 29 Jun 2007 06:39:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-condition/m-p/5055653#M747294</guid>
      <dc:creator>spex</dc:creator>
      <dc:date>2007-06-29T06:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Test Condition</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-condition/m-p/5055654#M747295</link>
      <description>yes $? != 0 means failed.&lt;BR /&gt;&lt;BR /&gt;for example&lt;BR /&gt;$ cd /nirvana&lt;BR /&gt;su: /nirvana:  not found.&lt;BR /&gt;$ cd /nirvana &amp;gt;/dev/null&lt;BR /&gt;su: /nirvana:  not found.&lt;BR /&gt;$ cd /nirvana &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;...no error msg&lt;BR /&gt;&lt;BR /&gt;2&amp;gt;&amp;amp;1 redirect the error msg (stderr) to /dev/null</description>
      <pubDate>Fri, 29 Jun 2007 06:44:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-condition/m-p/5055654#M747295</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2007-06-29T06:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Test Condition</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-condition/m-p/5055655#M747296</link>
      <description>THANKS A LOT !!!</description>
      <pubDate>Fri, 29 Jun 2007 06:51:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-condition/m-p/5055655#M747296</guid>
      <dc:creator>panchpan</dc:creator>
      <dc:date>2007-06-29T06:51:50Z</dc:date>
    </item>
    <item>
      <title>Re: Test Condition</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-condition/m-p/5055656#M747297</link>
      <description>&amp;gt;PCS: A single-bracket expression calls the test(1) command,&lt;BR /&gt;&lt;BR /&gt;This is incorrect.  This is also a shell built in.  Using tusc shows no execs.</description>
      <pubDate>Fri, 29 Jun 2007 18:52:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-condition/m-p/5055656#M747297</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-06-29T18:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: Test Condition</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-condition/m-p/5055657#M747298</link>
      <description>&amp;gt;what is the meaning of writing 2&amp;gt;&amp;amp;1 &lt;BR /&gt;&lt;BR /&gt;This is described in ksh(1) or sh-posix(1).  It basically executes the system call dup2(2) in the shell:  dup2(1,2)&lt;BR /&gt;Or: X&amp;gt;&amp;amp;Y  -&amp;gt;  dup2(Y, X)&lt;BR /&gt;&lt;BR /&gt;It closes stderr and duplicates the properties of stdout to stderr.&lt;BR /&gt;&lt;BR /&gt;In Oviwan's example, stdout is /dev/null so stderr is now that too.</description>
      <pubDate>Fri, 29 Jun 2007 19:22:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-condition/m-p/5055657#M747298</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-06-29T19:22:04Z</dc:date>
    </item>
  </channel>
</rss>

