官术网_书友最值得收藏!

Do while loop

As an alternative, we have included the do while loop. It is similar to a for loop, but better suited to dynamic conditions, such as when you do not know when a value will be returned or performing a task until a condition is met. The condition within the square brackets is the same as an if statement:

#!/bin/bash
CTR=1
while [ ${CTR} -lt 9 ]
do
echo "CTR var: ${CTR}"
((CTR++)) # Increment the CTR variable by 1
done
echo "Finished"
主站蜘蛛池模板: 冀州市| 民勤县| 仁化县| 颍上县| 九台市| 宁蒗| 无锡市| 文化| 襄垣县| 涞水县| 额敏县| 自贡市| 射阳县| 宁津县| 闻喜县| 金寨县| 金华市| 新昌县| 密山市| 海淀区| 宁乡县| 灌云县| 佛学| 大姚县| 虹口区| 平南县| 南京市| 阿拉善右旗| 云梦县| 西贡区| 柘荣县| 封开县| 青海省| 历史| 双城市| 塔河县| 无棣县| 黄陵县| 罗平县| 屏山县| 山阳县|