5.2 For Loops

The for loop

The for loop let’s you iterate over a series of ’words’ within a string. The basic syntax consists the commands for, do and done.

for loops

for i in hello world; do echo $i; done
#hello
#world
x="one two three"
for y in $x
do echo $y | sed ’s/t/T/’
done
#one
#Two
#Three