Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: issue with "for name ... [ in word ... ] term do list done"
- X-seq: zsh-users 30276
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: issue with "for name ... [ in word ... ] term do list done"
- Date: Wed, 18 Jun 2025 23:48:05 -0400
- Archived-at: <https://zsh.org/users/30276>
- In-reply-to: <20250619023133.GA32889@qaa.vinc17.org>
- List-id: <zsh-users.zsh.org>
- Openpgp: url=https://www.security.spodhuis.org/PGP/keys/key2020-cv25519.asc
- References: <20250619023133.GA32889@qaa.vinc17.org>
On 2025-06-19 at 04:31 +0200, Vincent Lefevre wrote:
> For instance,
>
> for i ab cd ; do do_something_with $i ; done
>
> in an interactive zsh shell does nothing, while the other shells
> signal a syntax error, which is much more useful.
Well, it does nothing if and only if there's nothing in argv.
% for x y z; echo ". {$x} / {$y} : {$z} ."
% set a b c d e f g h i j k l
% for x y z; echo ". {$x} / {$y} : {$z} ."
. {a} / {b} : {c} .
. {d} / {e} : {f} .
. {g} / {h} : {i} .
. {j} / {k} : {l} .
%
So it's valid and does something useful, iterating in tuples across the
"$@" array.
-Phil
Messages sorted by:
Reverse Date,
Date,
Thread,
Author