Tip: You can use { } instead of do/done to emulate C syntax.
Aside: [[ -v x ]] tests if the variable x is set. It should probably be [[ x -ne 0 ]] to match the example from the parent.
Aside: [[ -v x ]] tests if the variable x is set. It should probably be [[ x -ne 0 ]] to match the example from the parent.
In sh ? In bash ? In zsh ? I am very glad if it is so in any of them
for i in 1 2 3 4 5; { echo $i; }
for ((i=1;i<=5;i++)) { echo $i; }
(It doesn't work with `while` loops, at least not in bash.)while (ls) { echo Hello; echo World }
does work in zsh
But if your break a line after {, then you get while> prompt and } does not trigger execution