Re: comparison inside [[]] is not numeric comparison?
From:
Pierre Gaston
Subject:
Re: comparison inside [[]] is not numeric comparison?
Date:
Thu, 9 Dec 2010 20:48:09 +0200
On Sat, Nov 20, 2010 at 2:45 AM, john.ruckstuhl
<john.ruckstuhl@gmail.com> wrote:
> In bash, a comparison inside "[["/"]]" is lexicographic not numeric?
> This isn't what I expected.
> Which part of the documentation would set me straight? If someone
> could quote the fine manual, that would be great.
>
> $ if [[ 2000 > 200 ]]; then echo pass; else echo wierd; fi
> pass
>
> $ if [[ 1000 > 200 ]]; then echo pass; else echo wierd; fi
> wierd
>
> $ set | grep BASH_VERSION
> BASH_VERSION='3.2.51(24)-release'
>
> Thanks,
> John R.
>,http://www.gnu.org/software/bash/manual/bash.html#Bash-Conditional-Expressions
string1 < string2
True if string1 sorts before string2 lexicographically.
string1 > string2
True if string1 sorts after string2 lexicographically.