bug-bash
[Top][All Lists]
Advanced

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

Re: [[ ]] and [ ] tests not using the same ordering for strings.


From: Chet Ramey
Subject: Re: [[ ]] and [ ] tests not using the same ordering for strings.
Date: Tue, 30 Jul 2013 14:18:40 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130509 Thunderbird/17.0.6

On 7/30/13 6:00 AM, Jesper Brix Rosenkilde wrote:

> Bash Version: 4.2
> Patch Level: 45
> Release Status: release
> 
> Description:
> When comparing ' a' with '0a' using the less than operator, using [ ] and
> [[ ]] tests respectively gives different results.
> 
> Repeat-By:
> [ ' a' \< '0a' ] && echo ok
> [[ ' a' < '0a' ]] && echo ok

Yes.  The description of the [[ command says

        When used with [[, the < and > operators sort  lexicographically
        using the current locale.

The description that appears in the `CONDITIONAL EXPRESSIONS' section says:

        When used with [[, the < and > operators sort  lexicographically
        using the current locale.  The test command sorts using ASCII
        ordering.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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