Bash For Loops
A for loop repeats a block of commands for a known range or list. Useful for automation.
Example
#!/bin/bash
for i in {20..0}
do
echo "Countdown: $i"
sleep 1
doneHow to run it
- Save it to a file.
- Run
chmod +x filename.shwhere applicable. - Run it from the terminal.