<?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 Numeric comparaison with ksh in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/numeric-comparaison-with-ksh/m-p/5137442#M451669</link>
    <description>Hello&lt;BR /&gt;&lt;BR /&gt;I've a script with something like this :&lt;BR /&gt;&lt;BR /&gt;  SA=$(df -m -P | grep -i /logs | awk '{print $4}')&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;  if [[ $SA &amp;lt; 900.25 ]] ;then&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Here, is it a numeric compare or a string compare ?&lt;BR /&gt;&lt;BR /&gt;Bests regards&lt;BR /&gt;Den</description>
    <pubDate>Sat, 25 Oct 2008 19:11:47 GMT</pubDate>
    <dc:creator>Leo The Cat</dc:creator>
    <dc:date>2008-10-25T19:11:47Z</dc:date>
    <item>
      <title>Numeric comparaison with ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numeric-comparaison-with-ksh/m-p/5137442#M451669</link>
      <description>Hello&lt;BR /&gt;&lt;BR /&gt;I've a script with something like this :&lt;BR /&gt;&lt;BR /&gt;  SA=$(df -m -P | grep -i /logs | awk '{print $4}')&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;  if [[ $SA &amp;lt; 900.25 ]] ;then&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Here, is it a numeric compare or a string compare ?&lt;BR /&gt;&lt;BR /&gt;Bests regards&lt;BR /&gt;Den</description>
      <pubDate>Sat, 25 Oct 2008 19:11:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numeric-comparaison-with-ksh/m-p/5137442#M451669</guid>
      <dc:creator>Leo The Cat</dc:creator>
      <dc:date>2008-10-25T19:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric comparaison with ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numeric-comparaison-with-ksh/m-p/5137443#M451670</link>
      <description>I think that I could the necessary -le as &lt;BR /&gt;&lt;BR /&gt;if [[ $SA -le 900.25 ]] ;then&lt;BR /&gt;&lt;BR /&gt;correct in any situation?&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Den</description>
      <pubDate>Sat, 25 Oct 2008 19:44:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numeric-comparaison-with-ksh/m-p/5137443#M451670</guid>
      <dc:creator>Leo The Cat</dc:creator>
      <dc:date>2008-10-25T19:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric comparaison with ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numeric-comparaison-with-ksh/m-p/5137444#M451671</link>
      <description>sorry -gt &lt;BR /&gt;&lt;BR /&gt;;-)</description>
      <pubDate>Sat, 25 Oct 2008 19:49:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numeric-comparaison-with-ksh/m-p/5137444#M451671</guid>
      <dc:creator>Leo The Cat</dc:creator>
      <dc:date>2008-10-25T19:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric comparaison with ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numeric-comparaison-with-ksh/m-p/5137445#M451672</link>
      <description>Hi Den:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.docs.hp.com/en/B2355-60130/ksh.1.html" target="_blank"&gt;http://www.docs.hp.com/en/B2355-60130/ksh.1.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;For shells, the mathmatical symbol operators compare *strings* and the English-like ones (-lt, -gt, -le, -ge, -eq -ne) perform *numeric* comparisons.  &lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sat, 25 Oct 2008 20:51:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numeric-comparaison-with-ksh/m-p/5137445#M451672</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-10-25T20:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric comparaison with ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numeric-comparaison-with-ksh/m-p/5137446#M451673</link>
      <description>&lt;BR /&gt;Hmm, what version of Unix is that ?!&lt;BR /&gt;&lt;BR /&gt;HP-UX 11.31 does not have a -m option for df, only -k.&lt;BR /&gt;&lt;BR /&gt;Why not have awk do the grepping and the comparing? &lt;BR /&gt;A shell is not going to do the decimal fractions.&lt;BR /&gt;Awk is happy to.&lt;BR /&gt;&lt;BR /&gt;What will your scipt do when someone mounts /logs_backup or some such?&lt;BR /&gt;&lt;BR /&gt;SA=$(df -m -P | awk -i '/\/logs$/{print int ($4 - 900.25) }')&lt;BR /&gt;&lt;BR /&gt;Note: hpux does not have a -i with the standard awk. gawk has that. either speel out the mount point in proper casing or activate IGNORECASE or lowercase() the column.&lt;BR /&gt;&lt;BR /&gt;fwiw,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Sat, 25 Oct 2008 21:57:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numeric-comparaison-with-ksh/m-p/5137446#M451673</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-10-25T21:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric comparaison with ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numeric-comparaison-with-ksh/m-p/5137447#M451674</link>
      <description>&amp;gt;is it a numeric compare or a string compare?&lt;BR /&gt;&lt;BR /&gt;As mentioned, this is a string compare unless you have it within arithmetic expressions, (( )) or use awk(1).  And even there it will fail since ksh and sh don't do floating point.  You need ksh93:&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1151323" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1151323&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Hein: activate IGNORECASE or lowercase() the column.&lt;BR /&gt;&lt;BR /&gt;HP-UX's awk doesn't have IGNORECASE or lowercase() but has tolower().</description>
      <pubDate>Sun, 26 Oct 2008 11:09:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numeric-comparaison-with-ksh/m-p/5137447#M451674</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-10-26T11:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric comparaison with ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numeric-comparaison-with-ksh/m-p/5137448#M451675</link>
      <description>Thanks guys.</description>
      <pubDate>Wed, 17 Dec 2008 21:31:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numeric-comparaison-with-ksh/m-p/5137448#M451675</guid>
      <dc:creator>Leo The Cat</dc:creator>
      <dc:date>2008-12-17T21:31:33Z</dc:date>
    </item>
  </channel>
</rss>

