While will execute the loop as long as condition true.
When condition meet false it will terminate from the loop.
script:
#!/bin/bash
var=1
while [ $var -le 10 ]
do
echo "Loop $var"
(( var++ ))
done
output:
Loop 1
Loop 2
Loop 3
Loop 4
Loop 5
Loop 6
Loop 7
Loop 8
Loop 9
Loop 10
No comments:
Post a Comment