Ask Your Question
1

Why doesn't the curly bracket expansion globbing work for the ls list.files pattern?

asked 2023-05-29 12:41:23 +0000

huitzilopochtli gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-05-29 12:51:02 +0000

bukephalos gravatar image

The curly bracket expansion globbing works for patterns that are expanded by the shell, but the ls command does not expand the patterns itself. The patterns are passed directly to the underlying file system, and it is the file system that performs the matching and returns the results. The file system may or may not support curly bracket expansion or other advanced pattern matching features. Therefore, if you want to use curly bracket expansion with ls, you need to first expand the pattern using the shell and then pass the resulting file names to ls. For example:

ls {a,b,c}*

would be expanded by the shell to something like:

ls a* b* c*

and then the resulting file names would be passed to ls.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-05-29 12:41:23 +0000

Seen: 15 times

Last updated: May 29 '23