Bash While Loops
while repeats while a condition is true. Great for reading files or polling.
Example
#!/bin/bash
i=5
while (( i >= 0 )); do
echo "$i"
((i--))
doneHow to run it
- Save it to a file.
- Run
chmod +x filename.shwhere applicable. - Run it from the terminal.