<?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 evaluation doesn't work fine in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/if-evaluation-doesn-t-work-fine/m-p/4981505#M99731</link>
    <description>Thanks for your replies.&lt;BR /&gt;&lt;BR /&gt;Both bdf commands has numbers (I already checked it).&lt;BR /&gt;&lt;BR /&gt;About Peter message, I need numbers instead strings in order to evaluate if percentage I get with bdf command is greater than number I pass as parameter.&lt;BR /&gt;&lt;BR /&gt;Thanks for your help.&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Carles&lt;BR /&gt;</description>
    <pubDate>Tue, 30 May 2006 04:39:36 GMT</pubDate>
    <dc:creator>Carles Viaplana</dc:creator>
    <dc:date>2006-05-30T04:39:36Z</dc:date>
    <item>
      <title>if evaluation doesn't work fine</title>
      <link>https://community.hpe.com/t5/operating-system-linux/if-evaluation-doesn-t-work-fine/m-p/4981502#M99728</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I've following script:&lt;BR /&gt;&lt;BR /&gt;"check_disk2" 10 lines, 330 characters&lt;BR /&gt;# ./check_disk2 75 90 /dev/vglabccs/lvol1&lt;BR /&gt;DISK CRITICAL - [7926736 used (39%) on /dev/vglabccs/lvol1]&lt;BR /&gt;# more check_disk2&lt;BR /&gt;FREE="$(bdf $3 | tail -1 | cut -d ' ' -f 21)"&lt;BR /&gt;PERC="$(bdf $3 | tail -1 | cut -d ' ' -f 25 | cut -d % -f 1)"&lt;BR /&gt;&lt;BR /&gt;if [ $FREE -gt $2 ] ; then&lt;BR /&gt;        echo "DISK CRITICAL - [$FREE used ($PERC%) on $3]"&lt;BR /&gt;elif [ $FREE -gt $1 ] ; then&lt;BR /&gt;        echo "DISK WARNING - [$FREE used ($PERC%) on $3]"&lt;BR /&gt;else&lt;BR /&gt;        echo "DISK OK  - [$FREE used ($PERC%) on $3]"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;PERC is filesystem used percentage (without "%") and $1 and $2 are numbers. Problem is when I check if PERC is greater than $2 or $1 as always show DISK CRITICAL message:&lt;BR /&gt;&lt;BR /&gt;# ./check_disk2 75 90 /dev/vglabccs/lvol1&lt;BR /&gt;DISK CRITICAL - [7926736 used (39%) on /dev/vglabccs/lvol1]&lt;BR /&gt;# ./check_disk2 20 20 /dev/vglabccs/lvol1&lt;BR /&gt;DISK CRITICAL - [7926736 used (39%) on /dev/vglabccs/lvol1]&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;I think problem is script check values as strings instead numbers, so it can evaluate as I need.&lt;BR /&gt;&lt;BR /&gt;How can I evaluate them as numbers?&lt;BR /&gt;&lt;BR /&gt;Thanks in advande for your help.&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Carles&lt;BR /&gt;</description>
      <pubDate>Tue, 30 May 2006 03:52:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/if-evaluation-doesn-t-work-fine/m-p/4981502#M99728</guid>
      <dc:creator>Carles Viaplana</dc:creator>
      <dc:date>2006-05-30T03:52:01Z</dc:date>
    </item>
    <item>
      <title>Re: if evaluation doesn't work fine</title>
      <link>https://community.hpe.com/t5/operating-system-linux/if-evaluation-doesn-t-work-fine/m-p/4981503#M99729</link>
      <description>Carles,&lt;BR /&gt;by wrapping a " around your FREE and PERC evaluation you signal strings.&lt;BR /&gt;try:&lt;BR /&gt;FREE=`bdf $3 | tail -1 | cut -d ' ' -f 21`&lt;BR /&gt;PERC=`bdf $3 | tail -1 | cut -d ' ' -f 25 | cut -d % -f 1`&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 30 May 2006 04:05:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/if-evaluation-doesn-t-work-fine/m-p/4981503#M99729</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2006-05-30T04:05:21Z</dc:date>
    </item>
    <item>
      <title>Re: if evaluation doesn't work fine</title>
      <link>https://community.hpe.com/t5/operating-system-linux/if-evaluation-doesn-t-work-fine/m-p/4981504#M99730</link>
      <description>bdf $3 | tail -1 | cut -d ' ' -f 25 | cut -d % -f 1, is this ok ?&lt;BR /&gt;&lt;BR /&gt;is there 25. field in bdf's output ?</description>
      <pubDate>Tue, 30 May 2006 04:12:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/if-evaluation-doesn-t-work-fine/m-p/4981504#M99730</guid>
      <dc:creator>Kenan Erdey</dc:creator>
      <dc:date>2006-05-30T04:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: if evaluation doesn't work fine</title>
      <link>https://community.hpe.com/t5/operating-system-linux/if-evaluation-doesn-t-work-fine/m-p/4981505#M99731</link>
      <description>Thanks for your replies.&lt;BR /&gt;&lt;BR /&gt;Both bdf commands has numbers (I already checked it).&lt;BR /&gt;&lt;BR /&gt;About Peter message, I need numbers instead strings in order to evaluate if percentage I get with bdf command is greater than number I pass as parameter.&lt;BR /&gt;&lt;BR /&gt;Thanks for your help.&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Carles&lt;BR /&gt;</description>
      <pubDate>Tue, 30 May 2006 04:39:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/if-evaluation-doesn-t-work-fine/m-p/4981505#M99731</guid>
      <dc:creator>Carles Viaplana</dc:creator>
      <dc:date>2006-05-30T04:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: if evaluation doesn't work fine</title>
      <link>https://community.hpe.com/t5/operating-system-linux/if-evaluation-doesn-t-work-fine/m-p/4981506#M99732</link>
      <description>Hi Carles:&lt;BR /&gt;&lt;BR /&gt;You need to test 'PERC' not 'FREE' since 'PERC' has had the "%" string trimmed:&lt;BR /&gt;&lt;BR /&gt;if [ $PERC -gt $2 ] ; then&lt;BR /&gt;echo "DISK CRITICAL - [$FREE used ($PERC%) on $3]"&lt;BR /&gt;elif [ $PERC -gt $1 ] ; then&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 30 May 2006 05:07:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/if-evaluation-doesn-t-work-fine/m-p/4981506#M99732</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-05-30T05:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: if evaluation doesn't work fine</title>
      <link>https://community.hpe.com/t5/operating-system-linux/if-evaluation-doesn-t-work-fine/m-p/4981507#M99733</link>
      <description>Joder! You're right!&lt;BR /&gt;&lt;BR /&gt;I was evaluating wrong variable, so script and if construction are fine.&lt;BR /&gt;&lt;BR /&gt;Thanks for showing my little mistake that will allows me save a lot of work to some people.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Carles&lt;BR /&gt;</description>
      <pubDate>Tue, 30 May 2006 05:14:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/if-evaluation-doesn-t-work-fine/m-p/4981507#M99733</guid>
      <dc:creator>Carles Viaplana</dc:creator>
      <dc:date>2006-05-30T05:14:08Z</dc:date>
    </item>
  </channel>
</rss>

