<?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: Variable comparison in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248769#M174971</link>
    <description>'-eq' is for integer comparison...&lt;BR /&gt;&lt;BR /&gt;JP.&lt;BR /&gt;&lt;BR /&gt;P.S. I think this thread could be considered closed?</description>
    <pubDate>Fri, 16 Apr 2004 04:33:39 GMT</pubDate>
    <dc:creator>Jeroen Peereboom</dc:creator>
    <dc:date>2004-04-16T04:33:39Z</dc:date>
    <item>
      <title>Variable comparison</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248757#M174959</link>
      <description>Hi&lt;BR /&gt;In my script I have 2 variables which I want to compare against one another.&lt;BR /&gt;a="printer01-01 Apr 10:05"&lt;BR /&gt;b="printer01-01 Apr 10:05"&lt;BR /&gt;&lt;BR /&gt;What should the synthax be when i wanna equate whether these 2 are equal to each other?&lt;BR /&gt;Should it be $a == $b or wat? Please advise. Thanks in advance.</description>
      <pubDate>Thu, 15 Apr 2004 03:14:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248757#M174959</guid>
      <dc:creator>Yeo Khian Wei</dc:creator>
      <dc:date>2004-04-15T03:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: Variable comparison</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248758#M174960</link>
      <description>A possibility:&lt;BR /&gt;&lt;BR /&gt;if [ "$a" == "$b" ]&lt;BR /&gt;then&lt;BR /&gt; echo equal&lt;BR /&gt;else&lt;BR /&gt; echo unequal&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Quotes are essential.&lt;BR /&gt;&lt;BR /&gt;Or &lt;BR /&gt;if [[ $a == $b ]]&lt;BR /&gt;No quotes needed!&lt;BR /&gt;&lt;BR /&gt;JP.</description>
      <pubDate>Thu, 15 Apr 2004 03:18:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248758#M174960</guid>
      <dc:creator>Jeroen Peereboom</dc:creator>
      <dc:date>2004-04-15T03:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: Variable comparison</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248759#M174961</link>
      <description>Hi&lt;BR /&gt;I have tried as per suggested. But I'm still facing problem. When I tried the first suggestion,&lt;BR /&gt;&lt;BR /&gt;if ["$a"=="$b"]&lt;BR /&gt;then&lt;BR /&gt;echo equal&lt;BR /&gt;else&lt;BR /&gt;echo unequal&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;I got this error:&lt;BR /&gt;./test.sh[4]: [printer01-01 Apr 10:05==printer01-01 Apr 10:05]:  not found.&lt;BR /&gt;&lt;BR /&gt;Am I doing it correctly?&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Apr 2004 03:32:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248759#M174961</guid>
      <dc:creator>Yeo Khian Wei</dc:creator>
      <dc:date>2004-04-15T03:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: Variable comparison</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248760#M174962</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;there must be s space to separate the brackets from the stuff within.&lt;BR /&gt;[ "$a" == "$b" ]&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Apr 2004 03:43:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248760#M174962</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2004-04-15T03:43:11Z</dc:date>
    </item>
    <item>
      <title>Re: Variable comparison</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248761#M174963</link>
      <description>The error message is due to double equal sign... Just one =, not ==.&lt;BR /&gt;The right command line is:&lt;BR /&gt;&lt;BR /&gt;if [ "$a" = "$b" ]</description>
      <pubDate>Thu, 15 Apr 2004 03:47:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248761#M174963</guid>
      <dc:creator>Jdamian</dc:creator>
      <dc:date>2004-04-15T03:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: Variable comparison</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248762#M174964</link>
      <description>Following works:&lt;BR /&gt;&lt;BR /&gt;a="printer01-01 Apr 10:05"&lt;BR /&gt;b="printer01-01 Apr 10:05"&lt;BR /&gt;c="printer01-02 Apr 10:05"&lt;BR /&gt;&lt;BR /&gt;if test "$a" = "$b"&lt;BR /&gt;then&lt;BR /&gt;echo "equal"&lt;BR /&gt;else&lt;BR /&gt;echo "unequal"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;if [ "$a" = "$c" ]&lt;BR /&gt;then&lt;BR /&gt;echo "equal"&lt;BR /&gt;else&lt;BR /&gt;echo "unequal"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;sks</description>
      <pubDate>Thu, 15 Apr 2004 03:53:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248762#M174964</guid>
      <dc:creator>Sanjay Kumar Suri</dc:creator>
      <dc:date>2004-04-15T03:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: Variable comparison</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248763#M174965</link>
      <description>Actually, it's both the above problems.  THe space and the additional "="</description>
      <pubDate>Thu, 15 Apr 2004 03:54:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248763#M174965</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-04-15T03:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: Variable comparison</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248764#M174966</link>
      <description>If you can use the Korn Shell (ksh), the following works for me ..&lt;BR /&gt;&lt;BR /&gt;if [ "$a" = "$b" ]&lt;BR /&gt;then&lt;BR /&gt;echo blabla&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Kaps</description>
      <pubDate>Thu, 15 Apr 2004 03:56:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248764#M174966</guid>
      <dc:creator>KapilRaj</dc:creator>
      <dc:date>2004-04-15T03:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: Variable comparison</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248765#M174967</link>
      <description>Hmm,&lt;BR /&gt;&lt;BR /&gt;It ('==') behaved well on my Linux / bash. I'll have to check it (for myself). To be honest, I normally use one '=', but all these language differences...&lt;BR /&gt;&lt;BR /&gt;The space it there. It's funny: when I type my answers I have a mono-spaced font, and the spaces are clearly visible. But after posting the reply, the font is variable width and spaces are difficult to see.&lt;BR /&gt;That's why you should use Copy/Paste.&lt;BR /&gt;&lt;BR /&gt;Sorry for the confusion.&lt;BR /&gt;&lt;BR /&gt;JP.</description>
      <pubDate>Thu, 15 Apr 2004 09:08:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248765#M174967</guid>
      <dc:creator>Jeroen Peereboom</dc:creator>
      <dc:date>2004-04-15T09:08:27Z</dc:date>
    </item>
    <item>
      <title>Re: Variable comparison</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248766#M174968</link>
      <description>HI&lt;BR /&gt;     the better way to compare this if u r using kshell is&lt;BR /&gt;&lt;BR /&gt;if [ "${a}" = "${b} ]&lt;BR /&gt;then&lt;BR /&gt;        echo ${a} and ${b} are equal&lt;BR /&gt;else&lt;BR /&gt;        echo ${a} and ${b} are not equal&lt;BR /&gt;fi</description>
      <pubDate>Fri, 16 Apr 2004 00:44:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248766#M174968</guid>
      <dc:creator>Sathish C</dc:creator>
      <dc:date>2004-04-16T00:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Variable comparison</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248767#M174969</link>
      <description>The problem is not only the spaces between the '[', '"' and the ']', but also the space between the '"' and the '='. It should be:&lt;BR /&gt;if&lt;SPACE&gt;[&lt;SPACE&gt;"$a"&lt;SPACE&gt;=&lt;SPACE&gt;"$b"&lt;SPACE&gt;]&lt;BR /&gt;&lt;BR /&gt;&lt;/SPACE&gt;&lt;/SPACE&gt;&lt;/SPACE&gt;&lt;/SPACE&gt;&lt;/SPACE&gt;</description>
      <pubDate>Fri, 16 Apr 2004 01:29:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248767#M174969</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2004-04-16T01:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: Variable comparison</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248768#M174970</link>
      <description>You can also try if &lt;BR /&gt;[ "$a" -eq "$b" ]&lt;BR /&gt;to avoid the space or no space confusion.</description>
      <pubDate>Fri, 16 Apr 2004 04:21:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248768#M174970</guid>
      <dc:creator>Chia-Wei</dc:creator>
      <dc:date>2004-04-16T04:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: Variable comparison</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248769#M174971</link>
      <description>'-eq' is for integer comparison...&lt;BR /&gt;&lt;BR /&gt;JP.&lt;BR /&gt;&lt;BR /&gt;P.S. I think this thread could be considered closed?</description>
      <pubDate>Fri, 16 Apr 2004 04:33:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248769#M174971</guid>
      <dc:creator>Jeroen Peereboom</dc:creator>
      <dc:date>2004-04-16T04:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: Variable comparison</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248770#M174972</link>
      <description>Thanks for all the help.&lt;BR /&gt;Finally I'm able to test out my scripts now.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Khian Wei</description>
      <pubDate>Sun, 18 Apr 2004 20:15:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248770#M174972</guid>
      <dc:creator>Yeo Khian Wei</dc:creator>
      <dc:date>2004-04-18T20:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Variable comparison</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248771#M174973</link>
      <description>&lt;A href="http://us.itrc.hp.com/service/help/forums.do?Page=file0002" target="_blank"&gt;http://us.itrc.hp.com/service/help/forums.do?Page=file0002&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Kaps</description>
      <pubDate>Mon, 19 Apr 2004 00:23:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variable-comparison/m-p/3248771#M174973</guid>
      <dc:creator>KapilRaj</dc:creator>
      <dc:date>2004-04-19T00:23:31Z</dc:date>
    </item>
  </channel>
</rss>

