Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ranges
- X-seq: zsh-users 8944
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: "zsh-users" <zsh-users@xxxxxxxxxx>
- Subject: Re: ranges
- Date: Thu, 02 Jun 2005 16:19:58 +0000
- In-reply-to: <200506021557.22069.cht@xxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <milr91541g9uethehdcrs2ru7qir9iumpb@xxxxxxx> <200506011828.32719.cht@xxxxxxxxx> <nhbt91p3nauqo8e6664fagejs5thv1v70o@xxxxxxx> <200506021557.22069.cht@xxxxxxxxx>
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