- 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"
推薦閱讀
- 計算機網絡
- Vue.js快跑:構建觸手可及的高性能Web應用
- Scratch 3.0少兒編程與邏輯思維訓練
- Windows Server 2012 Unified Remote Access Planning and Deployment
- Python算法從菜鳥到達人
- 焊接機器人系統操作、編程與維護
- Go語言精進之路:從新手到高手的編程思想、方法和技巧(2)
- Python自然語言理解:自然語言理解系統開發與應用實戰
- 單片機原理及應用技術
- Node.js區塊鏈開發
- SCRATCH編程課:我的游戲我做主
- Building Microservices with Go
- jQuery基礎教程(第4版)
- Mastering PyCharm
- Activiti權威指南