On Sun, Sep 19, 2021, at 3:25 PM, 積丹尼 Dan Jacobson wrote: > $ help for > only mentions > for name [ [ in [ word ... ] ] ; ] do list ; done > and needs to be updated to mention > for (( expr1 ; expr2 ; expr3 )) ; do list ; done
Not particularly intuitive, but: bash-5.1$ help 'for ((' for ((: for (( exp1; exp2; exp3 )); do COMMANDS; done Arithmetic for loop. Equivalent to (( EXP1 )) while (( EXP2 )); do COMMANDS (( EXP3 )) done EXP1, EXP2, and EXP3 are arithmetic expressions. If any expression is omitted, it behaves as if it evaluates to 1. Exit Status: Returns the status of the last command executed. -- vq