While Loop in Bash Similar to for loop, while loop is also entry restricted loop. It means the condition is checked before executing while loop. While loop is also capable to do all the work as for loop can do. Syntax: while [condition] do //programme to execute done #1. Bash – While Loop Example For example, the following loop will be executed 5 times and terminated when the value of variable num will be greater than 5.
while [ $num -le 5 ]
#2. Bash – Infinite While Loop Infinite for loops can be also…Read More