Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: issue with "for name ... [ in word ... ] term do list done"



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