Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: ranges



When discussing {N..M} and {X,Y} in comparison to <N-M> and (X|Y), the
most important thing to keep in mind is:

Brace expansions create new strings.  Patterns select existing strings.

For example, [[ 7 = {1..9} ]] is nonsense, but [[ 7 = <1-9> ]] works.

David's summary goes wrong as soon as "ls" becomes the example command,
because that egregiously translates all the strings into the namespace
of existing files.  Neither braces nor patterns inherently operate on
files. (*)  A better example would have used "print" or "echo".


(*  Some glob qualifiers operate on files, but that's independent of the
pattern part.  The seeming special case of slashes in globbing occurs
not because the patterns are matched differently, but because globbing
interprets a series of patterns separated by slashes, comparing each
pattern in the series to a different set of existing strings, each set
happening to consist of file names.)



Messages sorted by: Reverse Date, Date, Thread, Author