while(liunx,unix)中的迴圈執行某程式用法
while是用在迴圈執行某程式
格式1:
while 條件;
do
語句
done
格式2:
while true/:/[1]/[0]
do
語句
done
示範1:
COUNTER=0
while [ $COUNTER -lt 10 ]; do
echo The counter is $COUNTER
let COUNTER=COUNTER+1
done
結果1:
The counter is 0
The counter is 1
The counter is 2
The counter is 3
The counter is 4
The counter is 5
The counter is 6
The counter is 7
The counter is 8
The counter is 9
示範2:
while true
do
date
sleep 3
done
結果2:
Mon Apr 29 23:51:08 CST 2013
Mon Apr 29 23:51:11 CST 2013
Mon Apr 29 23:51:14 CST 2013
Mon Apr 29 23:51:17 CST 2013
Mon Apr 29 23:51:20 CST 2013
Mon Apr 29 23:51:23 CST 2013
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26148431/viewspace-759537/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- mysql 中 while 迴圈的用法。MySqlWhile
- JavaScript中的while迴圈JavaScriptWhile
- C語言程式設計學習中while迴圈和do……while迴圈C語言程式設計While
- Java入門學習-學習if & else,for迴圈,foreach迴圈,while迴圈的用法。JavaWhile
- C語言——迴圈結構(for迴圈,while迴圈,do-while迴圈)C語言While
- C#程式設計基礎第七課:C#中的基本迴圈語句:while迴圈、do-while迴圈、for迴圈、foreach迴圈的使用C#程式設計While
- while迴圈While
- PHP For & While 迴圈PHPWhile
- Java 迴圈 - for, while 及 do…whileJavaWhile
- 04流程控制 for迴圈,while迴圈While
- python while迴圈PythonWhile
- linux while 迴圈LinuxWhile
- while迴圈補充While
- Tcl編寫迴圈執行某個任務的指令碼指令碼
- JavaScript如何中斷迴圈執行?JavaScript
- while read 迴圈中 呼叫ssh 遠端執行程式碼的一個超級大坑.While行程
- Java迴圈結構-for,while及do…whileJavaWhile
- Java while和do while迴圈詳解JavaWhile
- mysql 的procedure 中 loop迴圈的用法。MySqlOOP
- Java for迴圈中語句執行的順序Java
- Java 迴圈結構 - for, while 及 do...whileJavaWhile
- Runloop-執行迴圈OOP
- c#入門-while迴圈C#While
- java學習之while迴圈JavaWhile
- while + else 使用,while死迴圈與while的巢狀,for迴圈基本使用,range關鍵字,for的迴圈補充(break、continue、else) ,for迴圈的巢狀,基本資料型別及內建方法While巢狀資料型別
- 探討兩種迴圈表示方法的區別,while迴圈與for迴圈的小總結While
- Object-C,迴圈語句for,while,do-whileObjectWhile
- Python中迴圈語句中的else用法Python
- Python中for迴圈和while迴圈有什麼區別?Python入門教程PythonWhile
- python04: while迴圈語句 break continue for in 迴圈PythonWhile
- C#練習,應用for,while,do-while迴圈C#While
- web前端開發教程-while迴圈Web前端While
- 15-python之while迴圈PythonWhile
- java死迴圈while(true)vsfor(;;)JavaWhile
- JavaScript for迴圈 執行順序JavaScript
- PyThon range()函式中for迴圈用法Python函式
- 實驗5 迴圈結構程式設計(while、do-while語句的應用)程式設計While
- 實驗5迴圈結構程式設計(while、do-while語句的應用)程式設計While