On Wed, Dec 25, 2013 at 03:11:13PM -0800, Eduardo A. Bustamante López wrote: > On Wed, Dec 25, 2013 at 06:41:17PM +0400, vollitwr . wrote: > > The patterns [A-C] and [ABC] work different! [A-C] ignores case and > > [ABC] does not.
It's not actually ignoring case. It's just that in some locales, the collating order for letters is something like AaÁáÀàÄäBbCcÇç in which case [A-C] matches AaÁáÀàÄäBbC but not cÇç. > This is not a bug. It's well known that character set ranges depend > on your locale configuration. You seem to be expecting [A-C] to match > ASCII, but your (unspecified) locale expands differently. In > particular, it's the collation order that specifies which character > comes after which. If your locale is set to "C" or "POSIX", [ABC] and [A-C] will be equivalent to each other. In any other locale, the result of [A-C] is operating-system-specific. http://mywiki.wooledge.org/locale discusses this in a bit more detail. Bash 4.3 (currently in pre-release state) will introduce a new shell option, "globasciiranges", which will cause [A-C] to work as you expect, but this will not be the default behavior. If you want [A-C] to work like [ABC] by default, then you need to set your locale to C in the shell(s)/script(s) where you want that.