<?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: What is an integer? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/what-is-an-integer/m-p/5278703#M640663</link>
    <description>simply put an integer is a whole number, including zero. are you asking it in relation to a shell? what shell do you use? &lt;BR /&gt;&lt;BR /&gt;if you have difficulties with expressions, consult the man page:&lt;BR /&gt;&lt;BR /&gt;# man test&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;# man ksh&lt;BR /&gt;&lt;BR /&gt;can also help you, search for the keywords "while", "for" or "if". If you are using other shell look at its man page.</description>
    <pubDate>Tue, 05 Apr 2011 14:50:51 GMT</pubDate>
    <dc:creator>Viktor Balogh</dc:creator>
    <dc:date>2011-04-05T14:50:51Z</dc:date>
    <item>
      <title>What is an integer?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-is-an-integer/m-p/5278702#M640662</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;can anyone tell me the true definition of an integer?  My understanding is that is a whole number derived from a mathematical sum - info I found of the web:&lt;BR /&gt;&lt;BR /&gt;"An integer is what is more commonly known as a whole number. It may be positive, negative, or the number zero, but it must be whole. In some cases the definition of whole number will exclude the number zero, or even the set of negative numbers, but this is not as common as the more inclusive use of the term. Integers are the numbers people are most familiar with, and they serve a crucial role in virtually all mathematics."&lt;BR /&gt;&lt;BR /&gt;The reason I ask this question is because I want to know what is the correct syntax when using a test statement ie:&lt;BR /&gt;&lt;BR /&gt;is set MyVar=0 and to test this I would:&lt;BR /&gt;&lt;BR /&gt;if [ ${MyVar} = "0" ]; the&lt;BR /&gt;true&lt;BR /&gt;etc etc&lt;BR /&gt;&lt;BR /&gt;however if I created a sum or a count:&lt;BR /&gt;&lt;BR /&gt;count=0&lt;BR /&gt;&lt;BR /&gt;while [ ${count} -lt 10 ]; do&lt;BR /&gt;etc etc&lt;BR /&gt;(( count =+ ))&lt;BR /&gt;&lt;BR /&gt;I understand that using "= != &amp;lt; &amp;gt;"  is for testing a string so substituting MyVar=0 does "0" become a string.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Tue, 05 Apr 2011 14:39:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-is-an-integer/m-p/5278702#M640662</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2011-04-05T14:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: What is an integer?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-is-an-integer/m-p/5278703#M640663</link>
      <description>simply put an integer is a whole number, including zero. are you asking it in relation to a shell? what shell do you use? &lt;BR /&gt;&lt;BR /&gt;if you have difficulties with expressions, consult the man page:&lt;BR /&gt;&lt;BR /&gt;# man test&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;# man ksh&lt;BR /&gt;&lt;BR /&gt;can also help you, search for the keywords "while", "for" or "if". If you are using other shell look at its man page.</description>
      <pubDate>Tue, 05 Apr 2011 14:50:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-is-an-integer/m-p/5278703#M640663</guid>
      <dc:creator>Viktor Balogh</dc:creator>
      <dc:date>2011-04-05T14:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: What is an integer?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-is-an-integer/m-p/5278704#M640664</link>
      <description>&amp;gt; substituting MyVar=0 does "0" become a string.&lt;BR /&gt;&lt;BR /&gt;that's because the shell is auto-converting the value.</description>
      <pubDate>Tue, 05 Apr 2011 14:52:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-is-an-integer/m-p/5278704#M640664</guid>
      <dc:creator>Viktor Balogh</dc:creator>
      <dc:date>2011-04-05T14:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: What is an integer?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-is-an-integer/m-p/5278705#M640665</link>
      <description>Hi Chris:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I understand that using "= != &amp;lt; &amp;gt;" is for testing a string so substituting MyVar=0 does "0" become a string.&lt;BR /&gt;&lt;BR /&gt;Yes, I believe so.&lt;BR /&gt;&lt;BR /&gt;In the shell, you can declare an integer (as opposed to a string) with the 'typeset -i' declaration.  This speeds up arithmetic operations.&lt;BR /&gt;&lt;BR /&gt;In 'awk' programs you will sometimes see someone do:&lt;BR /&gt;&lt;BR /&gt;# awk '{$1+0 ...&lt;BR /&gt;&lt;BR /&gt;...which prevents you from doing silly arithmetic with non-numeric data.  Compare these results:&lt;BR /&gt;&lt;BR /&gt;# echo FF | awk '{SUM=($0+0);print SUM}'&lt;BR /&gt;&lt;BR /&gt;# echo FF | awk '{SUM=($0);print SUM}'&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 05 Apr 2011 14:57:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-is-an-integer/m-p/5278705#M640665</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-04-05T14:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: What is an integer?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-is-an-integer/m-p/5278706#M640666</link>
      <description>Thanks both for the quick response&lt;BR /&gt;&lt;BR /&gt;As I thought but wanted the experts to confirm &lt;BR /&gt;&lt;BR /&gt;8-)&lt;BR /&gt;&lt;BR /&gt;root:/scratch #echo FF | awk '{SUM=$0+0);print SUM}'&lt;BR /&gt;0&lt;BR /&gt;root:/scratch #echo FF | awk '{SUM=($0);print SUM}'&lt;BR /&gt;FF&lt;BR /&gt;</description>
      <pubDate>Tue, 05 Apr 2011 15:08:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-is-an-integer/m-p/5278706#M640666</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2011-04-05T15:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: What is an integer?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-is-an-integer/m-p/5278707#M640667</link>
      <description>&amp;gt;can anyone tell me the true definition of an integer?&lt;BR /&gt;&lt;BR /&gt;In the shell, an integer is something that's not a string. (And not a floating point number for shells that support those types.)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;if [ ${MyVar} = "0" ]; then&lt;BR /&gt;&lt;BR /&gt;This is a string comparison. If you know MyVar is an integer or numeric you should do:&lt;BR /&gt;if [ $MyVar -eq 0 ]; then&lt;BR /&gt;Or even:&lt;BR /&gt;if (( Myvar == 0 )); then&lt;BR /&gt;&lt;BR /&gt;&amp;gt;while [ ${count} -lt 10 ]; do&lt;BR /&gt;&lt;BR /&gt;Or:&lt;BR /&gt;while (( count &amp;lt; 10 )); do</description>
      <pubDate>Thu, 07 Apr 2011 05:45:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-is-an-integer/m-p/5278707#M640667</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-04-07T05:45:36Z</dc:date>
    </item>
    <item>
      <title>Re: What is an integer?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-is-an-integer/m-p/5278708#M640668</link>
      <description>use typeset&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;typeset -i MyVar=0&lt;BR /&gt;&lt;BR /&gt;if (( MyVar = 0 )); then&lt;BR /&gt;true&lt;BR /&gt;etc etc&lt;BR /&gt;&lt;BR /&gt;typeset -i count=0&lt;BR /&gt;&lt;BR /&gt;while (( count &amp;lt; 10 )); do&lt;BR /&gt;etc etc&lt;BR /&gt;(( count =+ ))&lt;BR /&gt;</description>
      <pubDate>Thu, 07 Apr 2011 05:56:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-is-an-integer/m-p/5278708#M640668</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2011-04-07T05:56:08Z</dc:date>
    </item>
  </channel>
</rss>

