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

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"
主站蜘蛛池模板: 江门市| 石柱| 泰兴市| 阜南县| 东乌珠穆沁旗| 桐城市| 榆中县| 台州市| 赤峰市| 蒙山县| 黑河市| 堆龙德庆县| 江油市| 泰兴市| 乳山市| 伊吾县| 宿迁市| 永新县| 南江县| 临桂县| 纳雍县| 且末县| 黎城县| 论坛| 饶平县| 海原县| 当涂县| 榆树市| 阿鲁科尔沁旗| 伽师县| 台江县| 云安县| 横峰县| 遂昌县| 和硕县| 崇阳县| 长寿区| 金山区| 德令哈市| 含山县| 岐山县|