- Bash Cookbook
- Ron Brash Ganesh Naik
- 85字
- 2021-07-23 19:17:31
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"
推薦閱讀
- Java高并發核心編程(卷2):多線程、鎖、JMM、JUC、高并發設計模式
- Responsive Web Design with HTML5 and CSS3
- Silverlight魔幻銀燈
- 編譯系統透視:圖解編譯原理
- Flutter跨平臺開發入門與實戰
- Terraform:多云、混合云環境下實現基礎設施即代碼(第2版)
- Machine Learning With Go
- Python編程:從入門到實踐(第3版)
- Building Serverless Web Applications
- 人工智能算法(卷1):基礎算法
- RocketMQ實戰與原理解析
- 網絡工程方案設計與實施(第二版)
- Yii框架深度剖析
- 數據結構和算法(Python和C++語言描述)
- Visual C++串口通信技術詳解(第2版)