Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 05-15-2006, 01:06 PM   #16
Senior Member
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,596

Rep: Reputation: 80

Some questions :
1/ Which shell are you using? Is it Bash?
2/ Which filesystem? If that is vfat, the case support is somewhat messy (there is some kind of case translation in order to support FAT32 case-incensitive filesystem).

Anyway I agree with you the result is very strange and certainly a bug somewhere indeed.
Old 05-15-2006, 02:09 PM   #17
Senior Member
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,285

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
(1) I'm using bash
(2) It does the same thing on both ext3 and xfs filesystems. Didn't try it on my shared Windows vfat, because I would expect problems there
Old 09-29-2016, 09:41 AM   #18
LQ Newbie
Registered: Jul 2004
Location: Austin, TX, USA
Posts: 10

Rep: Reputation: 1
Landed here trying to get *files starting with lower case only* output from /bin/ls.

Using bash 4.3.8 on Ubuntu 14.04 I was perplexed to see both upper and lower case when doing:

$ /bin/ls [a-z]*
First I short circuited all my aliases by invoking /bin/ls. Then I tried various pattern incantations. I googled around and found several things to try, but nothing seemed to work (in bash anyway, it's trivial to do with grep or find).

Then I remembered an ancient incantation from the old days with which I was frequently beaten over the head (by grey beards in charge) known as "RTFM", and I ended up learning about globasciiranges, which made it work:

$ ( shopt -s globasciiranges; /bin/ls [a-z]* )
The snippet from the man page was:

$ man bash
       Pattern Matching
              [...]  Matches  any  one of the enclosed characters.  A pair of characters separated by a hyphen denotes a range
                     expression; any character that falls between those two characters, inclusive, using the current
                     locale's collating sequence and character set, is matched.  If the first character following the
                     [ is a !  or a ^ then any character not enclosed is matched.  The sorting order of characters  in range
                     expressions is determined by the current locale and the values of the LC_COLLATE or LC_ALL shell
                     variables, if set.  To obtain the traditional interpretation of range expressions, where [a-d] is equiv‐
                     alent to [abcd], set value of the LC_ALL shell variable to C, or enable the globasciiranges shell
                     option.  A - may be matched by including it as the first or last character in the  set.   A  ]  may  be
                     matched by including it as the first character in the set.
1 members found this post helpful.
Old 12-28-2019, 11:11 PM   #19
LQ Newbie
Registered: Dec 2019
Posts: 1

Rep: Reputation: Disabled
Originally Posted by ioerror View Post
There's no need to use grep, the shell can handle this simple pattern matching:

ls [A-Z]*
That will display only uppercase ASCII characters of course.
I had to turn on globasciiranges on my system (Ubuntu 16.04, bash) in order to get this to work

shopt -s globasciiranges

Last edited by mo33; 12-28-2019 at 11:13 PM.
Old 12-29-2019, 11:24 AM   #20
LQ Veteran
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Xubuntu
Posts: 5,649

Rep: Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044
On Xubuntu with bash 4.4.20(1), ls [A-Z]* doesn't work but ls [[:upper:]]* does.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
upper case letter moonz Linux - General 3 09-18-2005 07:58 AM
Why are all my upper case files being shown as lower case?? [Kernel 2.6.9-1.667 FC3] t3gah Fedora 4 03-11-2005 05:09 PM
Lower case to upper case letter sudhasmyle Programming 1 12-03-2004 05:15 AM
K3B problems upper case Veteq Linux - General 2 03-06-2004 12:42 AM
Apache and upper or lower case. dsiguy Linux - General 3 02-04-2003 12:02 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:24 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration