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

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"
主站蜘蛛池模板: 甘南县| 寿阳县| 襄樊市| 大理市| 上林县| 甘南县| 洪湖市| 邵阳市| 元阳县| 新巴尔虎左旗| 天等县| 沾化县| 石楼县| 昌吉市| 湘西| 岐山县| 临武县| 青州市| 花莲市| 吉林市| 天峨县| 长汀县| 丹东市| 商河县| 柞水县| 东丰县| 南昌县| 湖南省| 济源市| 白银市| 清苑县| 濮阳县| 河池市| 丰镇市| 喀喇| 长汀县| 获嘉县| 建宁县| 台州市| 淮安市| 阳城县|