В цикле while на месте условия вы предоставляете true
, что означает, что условие всегда будет ИСТИНА и, следовательно, бесконечный цикл для.
Вот как работает цикл while
:
while condition
if condition is TRUE--> then go inside loop and do operations as per instructions in it.
if condition is FALSE--> then come out of loop since the given condition is no more.
Пример очень простого while
цикла:
while ((i<=3))
do
echo "Hey there..."
((i = i +1 ))
done
Вывод будет следующим.
Hey there...
Hey there...
Hey there...
Hey there...