[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: comparison inside [[]] is not numeric comparison?
From: |
Dennis Williamson |
Subject: |
Re: comparison inside [[]] is not numeric comparison? |
Date: |
Thu, 9 Dec 2010 10:50:03 -0600 |
On Thu, Dec 9, 2010 at 10:48 AM, Dennis Williamson
<dennistwilliamson@gmail.com> wrote:
> On Fri, Nov 19, 2010 at 6:45 PM, 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.
>>
>
> In man bash, in the CONDITIONAL EXPRESSIONS section:
>
> string1 < string2
> True if string1 sorts before string2 lexicographically in the
> current locale.
>
I meant to include:
Use (( ... ))
$ if (( 1000 > 200 )); then echo pass; else echo wierd; fi
pass
- comparison inside [[]] is not numeric comparison?, john.ruckstuhl, 2010/12/09
- Re: comparison inside [[]] is not numeric comparison?, DennisW, 2010/12/08
- Re: comparison inside [[]] is not numeric comparison?, Greg Wooledge, 2010/12/09
- Re: comparison inside [[]] is not numeric comparison?, Dennis Williamson, 2010/12/09
- Re: comparison inside [[]] is not numeric comparison?,
Dennis Williamson <=
- Re: comparison inside [[]] is not numeric comparison?, Andreas Schwab, 2010/12/09
- Re: comparison inside [[]] is not numeric comparison?, Daniel Fleischman, 2010/12/09
- Re: comparison inside [[]] is not numeric comparison?, Pierre Gaston, 2010/12/09