loops in shell script

for loop in shell script

for i in {1..5}
do
   echo "Welcome $i times"
done

Source: codegrepper

loops in shell script

#!/bin/bash
for i in 1 2 3 4 5
do
   echo "Welcome $i times"
done
-----------------------------------
#!/bin/bash
for i in {1..5}
do
   echo "Welcome $i times"
done
----------------------------------
#!/bin/bash
for i in {0..10..2}
  do 
     echo "Welcome $i times"
 done
------------------------------------
a=0
# -lt is less than operator
 
#Iterate the loop until a less than 10
while [ $a -lt 10 ]
do
    # Print the values
    echo $a
     
    # increment the value
    a=`expr $a + 1`
done

Source: codegrepper

For loop in shell script

for i in `seq 1 10`
do
	echo $i #Do something here.
done

Source: codegrepper