I needed a quick loop to count odd then even numbers in bash.
In this example I want to call a script called “script.sh” with an argument of an odd number from 1037 to 1059 recursively.
for (( i=1037; i<=1059; i=i+2 )) do script.sh $i done |
Obviously, for even numbers, start with an even number
for (( i=1038; i<=1059; i=i+2 )) do script.sh $i done |