[Bash] Repeat a command with a for loop

Created on November 30, 2026

Use an arithmetic for loop to initialize a counter, test a condition before each iteration, and increment the counter after each iteration.

for ((i=0; i<10; i++)); do
  echo $i
done
0
1
2
3
4
5
6
7
8
9
Bash