Character ranges are locale-dependant. Check the values of LC_ALL and
LC_COLLATE. Under some locales, the [A-Z] range is actually AaBb..Z. That's
why it's better to use the character classes, i.e. [[:alpha:]],
[[:lower:]], [[:upper:]], etc.

Unless you set the globasciiranges shopt:

  globasciiranges
If set, range expressions used in pattern matching bracket expressions (see
Pattern Matching) behave as if in the traditional C locale when performing
comparisons. That is, the current locale’s collating sequence is not taken
into account, so ‘b’ will not collate between ‘A’ and ‘B’, and upper-case
and lower-case ASCII characters will collate together.

Anyways, bash behavior here is correct. If you need some specific collation
order make sure to set your LC_* variables correctly, or use the POSIX
locale (LC_ALL=C)

Reply via email to