file globbing in now case insensitive?
Ralf Mardorf
silver.bullet at zoho.com
Mon Apr 3 08:26:08 UTC 2017
On Mon, 3 Apr 2017 00:42:29 +0100, Colin Watson wrote:
>Your example therefore does not work because LC_COLLATE is not set to C
>until after [A-Z]* has been expanded. If you're trying to construct
>something that sets this for just a single command, then a correct
>version would be:
>
> (LC_COLLATE=C; echo [A-Z]*)
Aha!
Why isn't it needed for LANG?
[rocketmouse at archlinux test]$ LANG=de_DE.utf8 mate-calc
[root at archlinux test]# grep PRETTY /etc/os-release
PRETTY_NAME="Arch Linux"
[root at archlinux test]# locale -a | grep C
C
[root at archlinux test]# ls
A b
[root at archlinux test]# (LC_COLLATE=C; echo [A-Z]*)
A
[root at archlinux test]# shopt | grep globasciiranges
globasciiranges off
[root at archlinux test]# shopt | grep -i case
nocaseglob off
nocasematch off
I'm running Ubuntu in a systemd-nspawn container...
[root at moonstudio test]# grep PRETTY /etc/os-release
PRETTY_NAME="Ubuntu 16.04.2 LTS"
[root at moonstudio test]# locale -a | grep C
C
C.UTF-8
[root at moonstudio test]# ls
A b
[root at moonstudio test]# echo [A-Z]*
A
[root at moonstudio test]# shopt | grep globasciiranges
globasciiranges off
[root at moonstudio test]# shopt | grep -i case
nocaseglob off
nocasematch off
...so I suspect it works related to:
[root at moonstudio test]# locale
LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
[root at moonstudio test]# locale -a
C
C.UTF-8
POSIX
de_DE
de_DE.iso88591
de_DE.iso885915 at euro
de_DE.utf8
de_DE at euro
deutsch
en_GB
en_GB.iso88591
en_GB.utf8
en_US.utf8
german
Arch Linux:
[root at archlinux test]# locale
LANG=en_US.utf8
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=
[root at archlinux test]# locale -a
C
de_DE
de_DE at euro
de_DE.iso88591
de_DE.iso885915 at euro
de_DE.utf8
deutsch
en_GB
en_GB.iso88591
en_GB.utf8
en_US.utf8
german
POSIX
[root at archlinux test]# ls
A b
[root at archlinux test]# (LC_COLLATE=POSIX; echo [A-Z]*)
A
Regards,
Ralf
More information about the ubuntu-users
mailing list