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.
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
Asked: 2023-05-29 12:41:23 +0000
Seen: 15 times
Last updated: May 29 '23
How can brackets in a filepath be managed when it is passed as a variable in the pipeline in Bash?
How can shell script be utilized to change questions in a text file into JSON format?
What causes a syntax error in a for loop and array in Pine Script?
Investigate the usage of square brackets.
How can the dataframe be transformed into a record list without including brackets?
What is the method for placing parentheses in column names when creating a table using an SQL query?
In R, how can one extract specific lines from a .txt file based on predetermined variable values?
What is the method for transferring values from JS to HTML tags in a Lightning Web Component?