LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

Rep: Reputation: 79

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, 01:09 PM   #17
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian
Posts: 2,190

Rep: Reputation: 338Reputation: 338Reputation: 338Reputation: 338
(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, 08:41 AM   #18
qneill
LQ Newbie
 
Registered: Jul 2004
Location: Austin, TX, USA
Posts: 10

Rep: Reputation: 0
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:

Code:
$ /bin/ls [a-z]*
AnUpperCaseFile
alowercasefile
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:

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

Code:
$ man bash
[...snip...]
       Pattern Matching
[...snip...]
              [...]  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.
 
  


Reply


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 06: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 04:09 PM
Lower case to upper case letter sudhasmyle Programming 1 12-03-2004 04:15 AM
K3B problems upper case Veteq Linux - General 2 03-05-2004 11:42 PM
Apache and upper or lower case. dsiguy Linux - General 3 02-04-2003 11:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:27 AM.

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