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 30277
- From: Lawrence Velázquez <larryv@xxxxxxx>
- To: "Vincent Lefevre" <vincent@xxxxxxxxxx>
- Cc: zsh-users@xxxxxxx
- Subject: Re: issue with "for name ... [ in word ... ] term do list done"
- Date: Thu, 19 Jun 2025 03:17:27 -0400
- Archived-at: <https://zsh.org/users/30277>
- Feedback-id: iaa214773:Fastmail
- In-reply-to: <20250619023133.GA32889@qaa.vinc17.org>
- List-id: <zsh-users.zsh.org>
- References: <20250619023133.GA32889@qaa.vinc17.org>
On Wed, Jun 18, 2025, at 10:31 PM, Vincent Lefevre wrote:
> I'm wondering whether the zsh extension about the optional "in word ..."
> can be disabled, or perhaps zsh could signal an error if it can detect
> that a name except the first one is not used.
To be clear (to other readers, if not you), the optionality of "in
word ..." isn't a zsh extension. It's well established and quite
portable [*]. The issue is that zsh's "for" command accepts multiple
variables, which means that omitting the "in" keyword in zsh produces
a differently valid "for" command, while in other shells it produces
an invalid one.
(I'm not aware of any options or tricks to accomplish either of the
behaviors you asked for, but I'll let someone else provide a more
definitive answer.)
[*] https://www.in-ulm.de/~mascheck/various/bourne_args/#endnote
--
vq
Messages sorted by:
Reverse Date,
Date,
Thread,
Author