bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LC_COLLATE not used for filename expansion


From: Chet Ramey
Subject: Re: LC_COLLATE not used for filename expansion
Date: Wed, 16 Jul 2008 17:39:29 -0400
User-agent: Thunderbird 2.0.0.14 (Macintosh/20080421)

Chris F.A. Johnson wrote:
With LC_COLLATE set to a locale with case-insensitive collation,
filename expansion does not use the locale. It does with LC_ALL.

In an empty directory:

$ touch a B c D e F
$ echo *
B D F a c e
$ LC_COLLATE=en_us
$ echo *
B D F a c e
$ LC_ALL=en_us
$ echo *
a B c D e F

It is, in fact, used to sort the results of filename expansion (as long
as strcoll is present and understands locales).  It seems like `en_us' is
not a valid locale value to assign to LC_COLLATE, but works with LANG.

Here's what I get with a slightly-instrumented bash:

$ cat x4
unset LC_COLLATE LC_ALL
echo LANG = $LANG
LC_COLLATE=C
cd scratch
touch a B c D e
echo *
LC_COLLATE=en_us
echo *
unset LC_COLLATE
LANG=en_us
echo *
LANG=C
LC_COLLATE=en_US.UTF-8
echo *
$ ./bash ./x4
LANG = en_US.UTF-8
TRACE: pid 25971: shell_glob_filename: LC_COLLATE = C
B D a c e
./x4: line 7: warning: setlocale: LC_COLLATE: cannot change locale (en_us): No such file or directory
TRACE: pid 25971: shell_glob_filename: LC_COLLATE = C
B D a c e
TRACE: pid 25971: shell_glob_filename: LC_COLLATE = en_US.UTF-8
a B c D e
TRACE: pid 25971: shell_glob_filename: LC_COLLATE = en_US.UTF-8
a B c D e

(FWIW, this is on ubuntu linux.)

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]