Basic bash loop
Looping through an explicit list of items
#!/bin/bash
for i in a B c 1 2 3
do
echo $i
done
Looping through a range of numbers.
#!/bin/bash
for i in {1..5}
do
echo $i
done
Looping through a range of letters.
#!/bin/bash
for i in {a..z}
do
echo $i
done
Looping through the output of the ls
command.
#!/bin/bash
for i in $(ls)
do
echo $i
done