bc-bd.org

Not a blog

Bash, Glob and Case

Is Bash matching lower- and uppercase files seemingly not caring about shopt -u nocaseglob, e.g.:

$ touch foo FOO
$ echo [a-z]*
foo FOO

then set LC_COLLATE to C, see man bash / Pattern Matching / LC_COLLATE:

The sorting order of characters in range expressions is determined by the current locale and the values of the LC_COLLATE or LC_ALL shell variables, if set. To obtain the traditional interpretation of range expressions, where [a-d] is equivalent to [abcd], set value of the LC_ALL shell variable to C, or […]