Why does the wildcard and GLOB pattern [A-Z] does not work as expected with 'ls' command ?

Solution Unverified - Updated -

Issue

  • If you have files created, say for example a, b, c and you want to list the files using the GLOB pattern as below :
[root@XXX ~]# touch a b c
[root@XXX ~]# ls -l [A-Z]
-rw-r--r-- 1 root root 0 Jul 21 19:31 b
-rw-r--r-- 1 root root 0 Jul 21 19:31 c
[root@XXX ~]# ls -l [A]
ls: cannot access [A]: No such file or directory
  • Now the issue is that inspite of giving a GLOB pattern [A-Z], we would expect only the files with name A to Z to be listed and not a to z.

Environment

  • Red Hat Enterprise Linux All

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.