So, basically the code below is giving an infinite loop. However, if i change i+2 and f+2 to i++ and f++, they don’t give an infinite loop. Can someone explain to me why this is? Thanks
#!/bin/bash
for ((i=0; i<5; i+2))
do
for ((f=0; f<5; f+2))
do
echo "$i $f"
done
done
You need to do
+=, not+(also, i+=2 should be f+=2 in your inner loop):