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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content