Bash For Loops

Syntax:

for var in <list>
do
<commands>
done

example:

named='Zaki Live .Com'
for nametame in $named
do
echo $nametame
done

we can check at the end that loop is not working by this

named='Zaki Live .Com'
for nametame in $named
do
echo $nametame
done
echo Voila La La

 

 

Another examples can be c like styles:

for (( c=1; c<=5; c++ ))
do
   echo "Welcome $c times"
done

Bash IF Else with for loop break and continue  have to practice later time 🙂

 

Here is the video all for loop explained beautifully

References:

http://www.cyberciti.biz/faq/bash-for-loop/

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published. Required fields are marked *