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

Vincent Lefevre <[email protected]>
Newsgroups gmane.comp.shells.zsh.user
Message-ID <[email protected]>
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 <[email protected]> - 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)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.