file globbing in now case insensitive?

Ralf Mardorf silver.bullet at zoho.com
Sun Apr 2 17:09:45 UTC 2017


On Sun, 2 Apr 2017 17:29:35 +0100, Colin Watson wrote:
>Or just export LC_COLLATE=C.UTF-8.

You not necessarily need to export it. However, this works for Ubuntu...

[root at moonstudio tmp]# grep PRETTY /etc/os-release 
PRETTY_NAME="Ubuntu 16.04.2 LTS"
[root at moonstudio tmp]# locale -a | grep C
C
C.UTF-8
[root at moonstudio tmp]# ls
A  b
[root at moonstudio tmp]# LC_COLLATE=C echo [A-Z]*
A
[root at moonstudio tmp]# LC_COLLATE=C.UTF-8 echo [A-Z]*
A

...but isn't portable. On Arch Linux...

[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 b

...it doesn't work. So if the OP should need it for command line on
Ubuntu only, it's ok, but for a portable script it might not do the job.

Regards,
Ralf








More information about the ubuntu-users mailing list