<?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: Abnormal if condition behavior in script. in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/abnormal-if-condition-behavior-in-script/m-p/3213392#M73423</link>
    <description>Alexander is obviously good enough with bash scripts :)&lt;BR /&gt; &lt;BR /&gt;He has your error :)&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;P.S. No points for this one please.</description>
    <pubDate>Tue, 09 Mar 2004 10:47:24 GMT</pubDate>
    <dc:creator>Mark Grant</dc:creator>
    <dc:date>2004-03-09T10:47:24Z</dc:date>
    <item>
      <title>Abnormal if condition behavior in script.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/abnormal-if-condition-behavior-in-script/m-p/3213390#M73421</link>
      <description>Hi all,&lt;BR /&gt;I input the attached file to the following script.&lt;BR /&gt;+++++++++++++++++++++++++++++++++++++++++++++&lt;BR /&gt;#!/bin/bash&lt;BR /&gt;num="`awk '/X-MailRelay-ToCount/{print $2}' $1`"&lt;BR /&gt;echo $num&lt;BR /&gt;if test "${num}" = "1"&lt;BR /&gt;then&lt;BR /&gt;        echo num eq to 1&lt;BR /&gt;else&lt;BR /&gt;        echo num not eq to 1&lt;BR /&gt;fi&lt;BR /&gt;exit&lt;BR /&gt;++++++++++++++++++++++++++++++++++++++++++++&lt;BR /&gt; But when I execute the script it doesn't not output the desired output.&lt;BR /&gt;Means when $num =1, it should output "num eq to 1" ,BUT it outputs the else part.&lt;BR /&gt;&lt;BR /&gt;Please help me to resolve this abnormal behavior.Any modifications to the script.&lt;BR /&gt;Big thank.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 09 Mar 2004 09:31:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/abnormal-if-condition-behavior-in-script/m-p/3213390#M73421</guid>
      <dc:creator>Nuwan Wijesundera</dc:creator>
      <dc:date>2004-03-09T09:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: Abnormal if condition behavior in script.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/abnormal-if-condition-behavior-in-script/m-p/3213391#M73422</link>
      <description>I think you should have == instead of =&lt;BR /&gt;in this line:&lt;BR /&gt;if test "${num}" = "1"&lt;BR /&gt;&lt;BR /&gt;I mean you want to say if it's equal then do something.&lt;BR /&gt;In your script it says it's equal .&lt;BR /&gt;Not that I'm great with bash scripts...</description>
      <pubDate>Tue, 09 Mar 2004 09:46:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/abnormal-if-condition-behavior-in-script/m-p/3213391#M73422</guid>
      <dc:creator>Alexander Chuzhoy</dc:creator>
      <dc:date>2004-03-09T09:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: Abnormal if condition behavior in script.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/abnormal-if-condition-behavior-in-script/m-p/3213392#M73423</link>
      <description>Alexander is obviously good enough with bash scripts :)&lt;BR /&gt; &lt;BR /&gt;He has your error :)&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;P.S. No points for this one please.</description>
      <pubDate>Tue, 09 Mar 2004 10:47:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/abnormal-if-condition-behavior-in-script/m-p/3213392#M73423</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-03-09T10:47:24Z</dc:date>
    </item>
    <item>
      <title>Re: Abnormal if condition behavior in script.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/abnormal-if-condition-behavior-in-script/m-p/3213393#M73424</link>
      <description>for example...&lt;BR /&gt;you use == for string comparison. &lt;BR /&gt;you use -eq for integer comparison.&lt;BR /&gt;</description>
      <pubDate>Tue, 09 Mar 2004 14:38:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/abnormal-if-condition-behavior-in-script/m-p/3213393#M73424</guid>
      <dc:creator>Olivier Drouin</dc:creator>
      <dc:date>2004-03-09T14:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: Abnormal if condition behavior in script.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/abnormal-if-condition-behavior-in-script/m-p/3213394#M73425</link>
      <description>use this &lt;BR /&gt;if [ ${num} -eq 1 ]; then&lt;BR /&gt; .....&lt;BR /&gt;&lt;BR /&gt;penguin</description>
      <pubDate>Tue, 09 Mar 2004 15:12:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/abnormal-if-condition-behavior-in-script/m-p/3213394#M73425</guid>
      <dc:creator>Penguin_1</dc:creator>
      <dc:date>2004-03-09T15:12:30Z</dc:date>
    </item>
  </channel>
</rss>

