bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash is not capable of comparing of strings and real numbers


From: Stephane Chazelas
Subject: Re: bash is not capable of comparing of strings and real numbers
Date: Fri, 11 Dec 2009 15:49:47 +0000 (UTC)
User-agent: slrn/pre1.0.0-16 (Linux)

2009-12-07, 22:22(+00), pk:
> phani krishna jampala wrote:
>
>> bash is not capable of comparing of strings ( imean interms of lessthan or
>> greater than etc) 
>
> It is, if you use [[  ]]
>
> a="abcd"
> b="bcde"
> if [[ "$b" > "$a" ]]; then
>   echo "$b is greater than $a"
> fi
[...]

Or the "[" (aka test) builtin:

[ "%b" \> "$a" ]

-- 
St├ęphane


reply via email to

[Prev in Thread] Current Thread [Next in Thread]