while loop is generally used for command or statement is repeatedly executed until the determination is not satisfied until the condition is false.
while loop syntax:
condition = condition
statements = statements
while [[ condition ]]; do
#statements
done
Or write:
while <conditional expression>
do
commands
done
See the article at small examples -