Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
issue with "for name ... [ in word ... ] term do list done"
- X-seq: zsh-users 30275
- From: Vincent Lefevre <vincent@xxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: issue with "for name ... [ in word ... ] term do list done"
- Date: Thu, 19 Jun 2025 04:31:33 +0200
- Archived-at: <https://zsh.org/users/30275>
- List-id: <zsh-users.zsh.org>
- Mail-followup-to: zsh-users@xxxxxxx
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.
The issue is that I forgot "in", and I was wondering why my command
was not working.
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.
BTW, words are optional, so that
for name ... [ in word ... ] term do list done
in the zshmisc(1) man page is incorrect. It should be
for name ... [ in [ word ] ... ] term do list done
And `in word' should be replaced by either `in' or `in [ word ]',
otherwise a case like "for i in ; do echo $i ; done" could be
misinterpreted.
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author