bash
and zsh
both know C-style for-loops:
From man 1 zshmisc
(man 1 bash
is essentially the same):
for (( [expr1] ; [expr2] ; [expr3] )) do list done
The arithmetic expression expr1 is evaluated first (see the section `Arithmetic Evaluation'). The arithmetic expression expr2 is repeatedly
evaluated until it evaluates to zero and when non-zero, list is executed and the arithmetic expression expr3 evaluated. If any expression is
omitted, then it behaves as if it evaluated to 1.
Example for zsh
:
for (( i=1; i<=$#txtlist; i++ )); do
echo "$txtlist[$i]" "$csvlist[$i]"
done
Example for bash
:
for (( i=0; i<=${#txtlist[@]}; i++ )); do
echo "${txtlist[$i]}" "${csvlist[$i]}"
done