Skip to main content
Tweeted twitter.com/StackUnix/status/876279531522404352
edited tags
Link
Gilles 'SO- stop being evil'
  • 865.9k
  • 205
  • 1.8k
  • 2.3k
Source Link
rosuav
  • 850
  • 2
  • 11
  • 18

Case sensitivity in square-bracket globbing

Normally, bash globbing is case sensitive:

$ echo c* casefix.pike cdless chalices.py charconv.py chocolate.pike circum.py clip.pike cpustats.pike crop.pike cwk2txt.py $ echo C* CarePackage.md ChocRippleCake.md Clips 

Using square brackets doesn't seem to change this:

$ echo [c]* casefix.pike cdless chalices.py charconv.py chocolate.pike circum.py clip.pike cpustats.pike crop.pike cwk2txt.py $ echo [C]* CarePackage.md ChocRippleCake.md Clips 

It still doesn't change it if a hyphen is used:

$ echo [c-c]* casefix.pike cdless chalices.py charconv.py chocolate.pike circum.py clip.pike cpustats.pike crop.pike cwk2txt.py $ echo [C-C]* CarePackage.md ChocRippleCake.md Clips 

But the letters are interspersed:

$ echo [B-C]* CarePackage.md casefix.pike cdless chalices.py charconv.py chocolate.pike ChocRippleCake.md circum.py clip.pike Clips cpustats.pike crop.pike cwk2txt.py $ echo [b-c]* beehive-anthem.txt bluray2mkv.pike branch branchcleanup.pike burdayim.pike casefix.pike cdless chalices.py charconv.py chocolate.pike circum.py clip.pike cpustats.pike crop.pike cwk2txt.py 

This suggests that the hyphen is using a locale order, "AaBbCcDd". So: is there any way to glob for all files that begin with an uppercase letter?