Software >> OS >> Unix >> Shell >> bash >> how to loop from 1 to 20 with a while loop

in one line:-

 

# i=0;while [ $i -lt 20 ]; do echo $i; i=$(($i + 1)); done

 

or multiple lines

 

i=0
while [ $i -lt 20 ]
do
   echo $i
   i=$(($i + 1))
done