Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: for loop with variable
- X-seq: zsh-users 30654
- From: Stephane Chazelas <stephane@xxxxxxxxxxxx>
- To: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- Cc: Ray Andrews <rayandrews@xxxxxxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: for loop with variable
- Date: Mon, 11 May 2026 19:10:57 +0100
- Archived-at: <https://zsh.org/users/30654>
- In-reply-to: <CAN=4vMrPSXyPkSX+bfZ0J8tuyujj-wU5Ly6Ba9073ERNb25p3Q@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- Mail-followup-to: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>, Ray Andrews <rayandrews@xxxxxxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- References: <a94bb2a4-b05c-4e22-97c7-a44ccd957e73@eastlink.ca> <CAN=4vMrPSXyPkSX+bfZ0J8tuyujj-wU5Ly6Ba9073ERNb25p3Q@mail.gmail.com>
2026-05-11 19:11:55 +0200, Roman Perepelitsa:
[...]
> {a..c} expands to a b c. You can iterate over that.
[...]
See also {a-c} with the braceccl option enabled (predates the
{a..c} variant). Makes for shorter code in more complicated
cases such as:
$ echo foo{{a..c},{x..z}}bar
fooabar foobbar foocbar fooxbar fooybar foozbar
$ echo foo{a-cx-z}bar
fooabar foobbar foocbar fooxbar fooybar foozbar
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author