Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

filename expansion with [a-z] matches upper case

9 views
Skip to first unread message

rob...@samco.com

unread,
Mar 30, 2007, 5:42:48 PM3/30/07
to bug-...@gnu.org
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: i386-redhat-linux-gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu' -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables
uname output: Linux mail.samco.com 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:08:39 EDT 2005 i686 i686 i386 GNU/Linux
Machine Type: i386-redhat-linux-gnu

Bash Version: 3.0
Patch Level: 16
Release Status: release

Description:
The expansion of the filename pattern "*.[a-z]* matches files with
upper case after the period, not just lower case, even though the
"nocaseglob" is set to off, when the LANG variable is set to
"en_US.UTF-8".

Repeat-By:
date >test.abc
date >test.ABC
ls *.[a-z]*
echo *.[a-z]*

Fix:
LANG=; export LANG

root

unread,
Mar 30, 2007, 5:41:54 PM3/30/07
to bug-...@gnu.org

Bob Proulx

unread,
Apr 1, 2007, 3:21:46 AM4/1/07
to rob...@samco.com, bug-...@gnu.org
rob...@samco.com wrote:
> The expansion of the filename pattern "*.[a-z]* matches files with
> upper case after the period, not just lower case, even though the
> "nocaseglob" is set to off, when the LANG variable is set to
> "en_US.UTF-8".

Yes. What you are seeing is not a bug in bash but is a configuration
selected by the LANG=en_US.UTF-8 locale setting. When that locale is
in effect the collation order is [aAbBcC...zZ] therefore when you
specify [a-z] you are getting [aAbBcC...z] all of the lower case
letters plus almost all of the upper case letters minus the Z.

This not only affects bash but all system utilities that use the
locale sort ordering. You will see this with ls, sort, grep, etc.

My personal setting is the following. This selects a UTF-8 locale in
general but overrides the collation sequence to specify a POSIX
standard sort ordering. YMMV.

export LANG=en_US.UTF-8
export LC_COLLATE=C

Bob


0 new messages