#1297·sh

zsh: support multiple parameter name in for loop

Author: LangLangBartCreated Mar 18, 2026Updated Mar 21, 2026
Labelszsh
bash
for a b c in $(seq 9); do echo $a $b $c; done
# 1 2 3
# 4 5 6
# 7 8 9
bash
./shfmt --language-dialect zsh <<<'for a b c in $(seq 9); do echo $a $b $c; done'
# <standard input>:1:1: `for foo` must be followed by `in`, `do`, `;`, or a newline

zsh docs

for name ... [ in word ... ] term do list done

More than one parameter name can appear before the list of words. If N names are given, then on each execution of the loop the next N words are assigned to the corresponding parameters.

https://zsh.sourceforge.io/Doc/Release/Shell-Grammar.html#Complex-Commands