What it does: Repeats a block for a sequence of values. The countdown shows numeric iteration and timing with sleep
.
What is a for loop? A for
loop lets you repeat a block of commands a fixed number of times, or iterate over a list of values.
Why use it? It’s useful for automation—looping through files, numbers, or arguments.
#!/bin/bash
for i in {20..0}
do
echo "Countdown: $i"
sleep 1
done