for loop in linux shell script - welcome n times

by RameshKumar 2010-01-23 14:55:42

To do any task n(can be any integer value) repeated time, we can use for loop as mentioned below in shell scripting

for (( i = 0 ; i <= 5; i++ ))
do
echo "Welcome $i times"
done


Output:
Welcome 0 times
Welcome 1 times
Welcome 2 times
Welcome 3 times
Welcome 4 times
Welcome 5 times

Tagged in:

749
like
0
dislike
0
mail
flag

You must LOGIN to add comments