?

Log in

No account? Create an account

Previous Entry | Next Entry

LOCALE considered harmful

crs@geomancer:/tmp/test$ echo $LANG
en_US
crs@geomancer:/tmp/test$ touch a A z Z
crs@geomancer:/tmp/test$ echo *
a A z Z
crs@geomancer:/tmp/test$ echo [a-z]
a A z
crs@geomancer:/tmp/test$ echo [A-Z]
A z Z
crs@geomancer:/tmp/test$ echo [a-Z]
a A z Z
crs@geomancer:/tmp/test$ echo [A-z]
A z

Comments

( 3 comments — Leave a comment )
alierak
Jan. 23rd, 2006 04:58 pm (UTC)
Heh. I started to try that on the Mac here, and hit a little snag -- with a case-insensitive case-preserving filesystem, touch a A z Z only creates two files...
geekosaur
Jan. 23rd, 2006 05:02 pm (UTC)
Isn't it lovely how enabling en_US makes filename comparison (but not the filesystem itself!) case insensitive?
(Anonymous)
Jan. 23rd, 2006 06:15 pm (UTC)
Specifically it's globbing that it's making case insensitive.

Note that given the order you see in the "echo *" output the rest of it all follows logically.

Your locale files have en_US being not strictly case insensitive. Capital letters appear to sort immediately after the corresponding lower case letter.

That's because you get other strange effects if the collation has unequal strings comparing equal.
( 3 comments — Leave a comment )

Profile

highway
crs
just a guy made of dots and lines
Home

Latest Month

September 2012
S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829
30      
Powered by LiveJournal.com
Designed by Tiffany Chow