Skip to main content
1 of 2
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?

rosuav
  • 850
  • 2
  • 11
  • 18