Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.