When did linux become caseless?
rgarciasuarez at gmail.com
Fri Jun 15 11:18:20 BST 2007
On 15/06/07, Dirk Koopman <djk at tobit.co.uk> wrote:
> Subject says it all really. Just did "rm [A-Z]*" and had a load of files
> with lower case first letters removed as well. Same thing happens for
> "ls -d [A-Z]*"
> I am guessing that this some bash argument expansion option. Any ideas
> as to how to get the correct behaviour?
Oh, you've been hit by the most hateful feature of POSIX regexps.
Ranges depend on the collation order defined in your locale. And yes,
in the C locale that's not case-dependent.
As says regex(7) : "Ranges are very collating-sequence-dependent, and
portable programs should avoid relying on them."
Workarounds: use perl or anything that has a sensible regexp engine,
or write [abcdefghijklmnopqrstuvwxz].
More information about the london.pm