On Tue, Jan 30, 2018 at 01:54:36PM -0500, ken young wrote: > uname output: Linux Microknoppix 4.12.7-64 #13 SMP PREEMPT Tue Aug 15 > 04:56:38 CEST 2017 x86_64 GNU/Linux > Machine Type: i686-pc-linux-gnu > > Bash Version: 4.4 > Patch Level: 12 > Release Status: release > > I have a directory with four files A Z a z only. > "ls [A-Z]" displays only 3 files A Z z ;a is missing > "ls [a-z]" displays only 3 files A a z ;Z is missing
The behavior of range expressions in globs depends on your locale setting. The legacy range expressions [A-Z] and [a-z] only work the way you expect when your locale is set to "C" or "POSIX". If you want to match only uppercase letters (whatever those are in your locale), you must use [[:upper:]] instead. To match only lowercase letters (whatever those are), use [[:lower:]] instead. See <http://mywiki.wooledge.org/locale> for more details. wooledg:~$ mkdir /tmp/x && cd "$_" wooledg:/tmp/x$ touch A Z a z wooledg:/tmp/x$ ls [A-Z] A z Z wooledg:/tmp/x$ ls [[:upper:]] A Z wooledg:/tmp/x$ ls [[:lower:]] a z wooledg:/tmp/x$ locale LANG=en_US.UTF-8 LANGUAGE= LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL=