rkh
rkh

Reputation: 1

Bash globbing range in home dir shows content of subdirectories

When I am using ls [A-Z]* in my home directory in the bash shell (5.1.8(1)) then it shows me not only the files in my home directory, but also of the subfolders. Why is that and is there a way to suppress this behavior?

Upvotes: 0

Views: 80

Answers (1)

KamilCuk
KamilCuk

Reputation: 141493

Bash globbing range in home dir shows content of subdirectories

No, ls command shows you content of subdirectories.

Why is that

Because that is what ls does when given a directory name, it shows the directories content.

is there a way to suppress this behavior?

From man ls:

   -d, --directory
          list directories themselves, not their contents

Just ls -d.

Upvotes: 5

Related Questions