[CentOS] Maybe OT : strange wildcard behaviour

Sun Oct 24 11:53:48 UTC 2010
Nicolas Thierry-Mieg <Nicolas.Thierry-Mieg at imag.fr>

Niki Kovacs wrote:
> Hi,
>
> I'm currently working through some basic HOWTOS (Linux Fundamentals 1-4
> by Gentoo founder Daniel Robbins) on a CentOS 5.5 server, just to keep
> in shape.
>
> I've just noticed a curious wildcard behaviour, which I can't really
> explain. Let's say I wanted to list all the files or directories in /tmp
> starting with any uppercase character. Normally, I would do this :
>
> $ ls -d /tmp/[A-Z]*
>
> Curiously enough, this command lists *all* the content of /tmp,
> consisting of a majority of files and directories starting with a
> *lowercase* character. I've tested this on two different machines, with
> the same results. I'm puzzled.
>
> Can anybody offer an explanation for this curious behaviour ?

probably "expected" behavior, depending on your locale.
google for LC_COLLATE.

LC_COLLATE='C' ; ls -d /tmp/[A-Z]*
should do what you want.