Syntax:
while [condition], do
order
done
order
done
example:
#!/bin/bash
x=1;
while [ $x - le 10] ; do
echo "The inscription appears: $x"
x=$ [x + 1]
done
x=1;
while [ $x - le 10] ; do
echo "The inscription appears: $x"
x=$ [x + 1]
done
Condition is checked whether the variable xo initial value 1 is less than or equal to 10, the condition is true so that the commands are executed inside the loop: echo "The inscription appears at once: $x" and x=$[x + 1], which increases the value of the variable x about one. When the value of x exceeds 10, the execution of the loop is broken.