<?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: If [ ] and [[ ]] in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/if-and/m-p/3470852#M704202</link>
    <description>&lt;BR /&gt;And you cannot use boolean expressions with [[. You will need to use [ to use boolean operators&lt;BR /&gt;&lt;BR /&gt;# S=1&lt;BR /&gt;# [[ $S -eq 10 -o $S -gt 10 ]]&lt;BR /&gt;ksh: syntax error: `-o' unexpected&lt;BR /&gt;# [ $S -eq 10 -o $S -gt 10 ]  &lt;BR /&gt;#</description>
    <pubDate>Tue, 25 Jan 2005 14:59:09 GMT</pubDate>
    <dc:creator>Sundar_7</dc:creator>
    <dc:date>2005-01-25T14:59:09Z</dc:date>
    <item>
      <title>If [ ] and [[ ]]</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-and/m-p/3470850#M704200</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I noticed that sometimes&lt;BR /&gt;"if [ $A = $B ]" is used and other times&lt;BR /&gt;"if [[ $A = $B ]]" is used. Is there a difference or is it just a personal choice?&lt;BR /&gt;&lt;BR /&gt;TIA,&lt;BR /&gt;Ryan</description>
      <pubDate>Tue, 25 Jan 2005 14:53:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-and/m-p/3470850#M704200</guid>
      <dc:creator>Ryan Clerk</dc:creator>
      <dc:date>2005-01-25T14:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: If [ ] and [[ ]]</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-and/m-p/3470851#M704201</link>
      <description>In more modern shells (Posix, ksh, ...) that support the "[[ ... ]]" syntax for if the difference is that "[[ .. ]]" is an internal (to the shell) test whereas "[ .. ]" invokes the external test command. The double brackets are thus more efficient.&lt;BR /&gt;</description>
      <pubDate>Tue, 25 Jan 2005 14:55:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-and/m-p/3470851#M704201</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-01-25T14:55:57Z</dc:date>
    </item>
    <item>
      <title>Re: If [ ] and [[ ]]</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-and/m-p/3470852#M704202</link>
      <description>&lt;BR /&gt;And you cannot use boolean expressions with [[. You will need to use [ to use boolean operators&lt;BR /&gt;&lt;BR /&gt;# S=1&lt;BR /&gt;# [[ $S -eq 10 -o $S -gt 10 ]]&lt;BR /&gt;ksh: syntax error: `-o' unexpected&lt;BR /&gt;# [ $S -eq 10 -o $S -gt 10 ]  &lt;BR /&gt;#</description>
      <pubDate>Tue, 25 Jan 2005 14:59:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-and/m-p/3470852#M704202</guid>
      <dc:creator>Sundar_7</dc:creator>
      <dc:date>2005-01-25T14:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: If [ ] and [[ ]]</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-and/m-p/3470853#M704203</link>
      <description>I should also add that in addition the syntax changes a bit as well --- especially the boolean operators.&lt;BR /&gt;&lt;BR /&gt;e.g. (and)&lt;BR /&gt;&lt;BR /&gt;if [ ${A} = ${B} -a ${A} = ${C} ]&lt;BR /&gt;&lt;BR /&gt;is written&lt;BR /&gt;&lt;BR /&gt;if [[ ${A} = ${B} &amp;amp;&amp;amp; ${A} = ${C} ]].&lt;BR /&gt;&lt;BR /&gt;Similarly, -o (or) becomes ||.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 25 Jan 2005 14:59:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-and/m-p/3470853#M704203</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-01-25T14:59:31Z</dc:date>
    </item>
    <item>
      <title>Re: If [ ] and [[ ]]</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-and/m-p/3470854#M704204</link>
      <description>Another noticeable difference is that you can do pattern matching under [[ ]]&lt;BR /&gt;&lt;BR /&gt;&amp;gt; if [[ "toto" = toto* ]]; then echo equals; else echo "not equal"; fi  &lt;BR /&gt;&lt;BR /&gt;equals&lt;BR /&gt;&lt;BR /&gt;&amp;gt; if [ "toto" = toto* ]; then echo equals; else echo "not equal"; fi  &lt;BR /&gt;&lt;BR /&gt;not equal&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.kornshell.com/doc/faq.html" target="_blank"&gt;http://www.kornshell.com/doc/faq.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Q10. What is the difference between [...] and [[...]]?&lt;BR /&gt;A10. The [[...]] is processed as part of the shell grammar&lt;BR /&gt; whereas [...] is processed like any other command.&lt;BR /&gt; Operators and operands are detected when the command is&lt;BR /&gt; read, not after expansions are performed.  The shell does not&lt;BR /&gt; do word splitting or pathname generation inside  [[...]].&lt;BR /&gt; This allows patterns to be specified for string matching&lt;BR /&gt; purposes.&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Jan 2005 15:53:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-and/m-p/3470854#M704204</guid>
      <dc:creator>MAUCCI_2</dc:creator>
      <dc:date>2005-01-26T15:53:36Z</dc:date>
    </item>
  </channel>
</rss>

