Quantcast
Channel: Webminal - Latest topics
Viewing all articles
Browse latest Browse all 484

How to write simple while loop in bash?

$
0
0

@laks wrote:

 COUNTER=0
 while [  $COUNTER -lt 10 ]; do
     echo The counter is $COUNTER
     let COUNTER=COUNTER+1 
 done

We initialize the loop counter on line-1 and increment the counter on line-4. The echo statement is executed until the the while loop condition is satisfied. (i.e) counter less than 10.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 484

Trending Articles