Re: for loop with variable

Mikael Magnusson <[email protected]> Mon, 11 May 2026 20:50:33 +0200
Newsgroups gmane.comp.shells.zsh.user
Message-ID <CAHYJk3QBH0YtN0qPd7yfi6itMS+q=nzdEG4ZiRtMkgSMbNT2jw@mail.gmail.com>
On Mon, May 11, 2026 at 8:11=E2=80=AFPM Stephane Chazelas <stephane@chazela=
s.org> wrote:
>
> 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

Braceccl syntax will a) sort the results for you which you may not
want, eg {x-za-c} will give the exact same results as the above, b) it
does not support multibyte at all, c) requires you to setopt braceccl.
It is a lot of drawbacks to save typing five characters.

--=20
Mikael Magnusson