while Linux Commands
What is Linux while Command?
while COMMAND:while command is a looping command. It is used to execute set of statements repeatedly till it satisfies the condition when we run a script or a program.
while [ condition ]
In the above syntax, the command 1,2 and 3 are the statements to be executed till a specified condition is satisfied.
while [ $x -le 10 ]
In the above example, the condition of while loop is to check x <= 10.
echo '$x times'
x=$(( $x + 1 ))
The loop executes till the condition gets satisfied and
stops when x becomes greater than 10.
-le - stands for less than, use -gt for greater than.