Hi Chuck,

the problem comes from the locale settings. You can see it as follows:
(In the examples replace en_US.UTF-8 with the locale you actually use. You can 
check with the locale command)

$ mkdir old
$ cd old
$ touch a A A1 b c d E F G H
$ LANG=C ls
A  A1  E  F  G  H  a  b  c  d
$ LANG=en_US.UTF-8 ls
a  A  A1  b  c  d  E  F  G  H

See how they're sorted differently? So this means that in the C locale
the letters are sorted ABC...XYZabc...xzy, but in the other locales they
may be sorted differently, in most cases like this: aAbBcC...xXyYzZ

So when you specify [a-z] the results depend on the ordering of the
letters in the locale. You can also see this by noting that [a-z] does
*not* include Z but all other capital letters.

$ touch z Z
$ LANG=en_US.UTF-8 ls [a-z]*
a  A  A1  b  c  d  E  F  G  H  z
$ LANG=en_US.UTF-8 ls [a-Z]*
a  A  A1  b  c  d  E  F  G  H  z  Z

So the behaviour is somewhat expected, though I agree that it is very
confusing. It would be interesting to know whether this was any
different in previous Ubuntu releases, but I'd guess it's the same
there.

I'm afraid I don't have an easy solution short of setting your locale to
C...

** Changed in: bash (Ubuntu)
       Status: New => Confirmed

-- 
[a-z] does not work as expected in non-C locales
https://bugs.launchpad.net/bugs/208100
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to