bash LC_COLLATE or LC_ALL set “C” not sort in dictionary order.
bonomi at mail.r-bonomi.com
Tue Jan 31 14:27:37 UTC 2012
> From owner-freebsd-questions at freebsd.org Tue Jan 31 05:45:47 2012
> Date: Tue, 31 Jan 2012 04:45:36 -0800
> From: Edward Martinez <eam1edward at gmail.com>
> To: FreeBSD Questions <freebsd-questions at freebsd.org>
> Subject: bash LC_COLLATE or LC_ALL set =?windows-1252?q?=93C=94_not__sort?=
> Been trying to get BASH to sort set characters in dictionary order.
> I typed "locale" and it shows LC_COLLATE and LC_ALL are set to "C"
> thought that was enough to work,
> however when i type metacharacters: set character; any character,
> something like this:
> ls [a-cx-y]*
> bash does not sort in dictionary order; file "Binarc" does not
*OF*COURSE* it doesn't. Unix is _case_sensitive_. You specified a lower-
case only (in the C locale) pattern. Naturally, it doesn't match a file
with an upper-case character in it.
Note: in the 'C' locale, characters are sorted on the underlying byte value.
Thus you will get all the upper-case matches before any lower-case match.
To get upper-and-lower case files in the C locale, you will have to use:
IF you speciy a different charset for collating, you _may_ get upper/lower
case characters sorted adjacently. See the specifications for the charset
More information about the freebsd-questions