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

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"
主站蜘蛛池模板: 苏尼特右旗| 福州市| 肇东市| 吉木乃县| 遂平县| 正安县| 迭部县| 长汀县| 福安市| 武穴市| 巢湖市| 鄂托克旗| 普陀区| 庄河市| 永平县| 罗甸县| 碌曲县| 高州市| 通化县| 宕昌县| 会理县| 多伦县| 荣昌县| 扎赉特旗| 乐至县| 文水县| 安庆市| 都江堰市| 海盐县| 衡东县| 临桂县| 乌什县| 栾城县| 南昌县| 凌源市| 日照市| 安陆市| 阳东县| 霍城县| 龙井市| 海宁市|