While Loop Shell Scripting

While Loop - Shell Scripting

While Loop - Shell Scripting - 5.0 out of 5 based on 1 vote
User Rating:  / 1
PoorBest 

While loop will work when the condition is true. If the condition is true for infinite times then the loop will run for infinite times. 

Code:

open a editor and write the below mentioned code,

#!/bin/bash

a=10

while [[ $a -lt 20 ]]

do

 echo "$a"

 a=$((a + 1))

done

To execute:

sh while.sh