In all versions of bash since 2001 (e.g. 5.1.16(1)-release), the following
syntax works but is not documented:$ for (( i=0; i<3; ++i )) { echo $i; }
0
1
2
The manpage only lists this syntax: for (( expr1 ; expr2 ; expr3 )) ; do list
; done$ bash --version | head -1 # on a Dell desktop, linux mint virginia
(ubuntu jammy)
GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)Bug: please document
this extended/alternate syntax for the for loop.See also my question at
https://unix.stackexchange.com/questions/792066/why-does-this-bash-for-loop-syntax-workand
some more information at
https://unix.stackexchange.com/questions/306940/what-is-the-purpose-of-the-do-keyword-in-bash-for-loops/306944#306944
Thanks!-- John Wiersba