Operating System - HP-UX
1823079 Members
3389 Online
109645 Solutions
New Discussion

comparison check in shell script

 
SOLVED
Go to solution
andi_1
Frequent Advisor

comparison check in shell script

Hi,

I have the following code:

if [ $tmpPESize>$tmp1 ]; then
echo "hello"
fi

but for some reason, it always prints 'hello' even if $tmpPESize is 8 and tmp1 is 1

Any ideas why?

Thank you.
1 REPLY 1
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: comparison check in shell script

Hi:

If think your want:

if [ ${a} -gt ${b} ] # greater than
-ge greater than or equal to
-lt
-le
-eq
-ne

These are the numeric comparison operators
If it ain't broke, I can fix that.