2

Errors with 'echo [A-Z]*'

I am working on the root directory and intending to print those starting with upper letter.

$ echo [A-Z]*
Applications Library Network System Users Volumes bin cores dev etc home installer.failurerequests net private sbin tmp usr var vm

The result confuses me because cores dev etc home installer.failurerequests net private sbin tmp usr var vm doesn't match my pattern.

How to resolve it?

2
  • Are you using Apple's built in Terminal CLI? Is there anything in your .profile or .bashrc, etc? This pattern matching echo [A-Z]* works absolutely as intended in both my home and root directories, as well as logged out in the basic sh shell. So, it's definitely not a problem with syntax but some issue with your configuration. Wish I could be of more assistance.
    – njboot
    Mar 25 '18 at 3:30
  • 1
    Bash has a 'nocaseglob' option which, if set, would cause this behaviour. You can check its value with 'shopt nocaseglob' and turn it off with 'shopt -u nocaseglob'. Mar 25 '18 at 14:59

You must log in to answer this question.

Browse other questions tagged .