【转】shell学习笔记(七)——流程控制之while
2014-05-18 22:33
573 查看
while do done, until do done (不定回圈)
当 condition 条件成立时,就进行回圈,直到 condition 的条件不成立才停止
while [condition] -->中括号内的状态就是判断式
do -->回圈的开始
程序段落
done -->回圈的结束
例如:
#!/bin/bash
num=1
while [ $num -le 10 ]
do echo -e "\t the num is $num"
let num=num+1
done
运行输出:
the num is 1
the num is 2
the num is 3
the num is 4
the num is 5
the num is 6
the num is 7
the num is 8
the num is 9
the num is 10
当 condition 条件成立时,就进行回圈,直到 condition 的条件不成立才停止
while [condition] -->中括号内的状态就是判断式
do -->回圈的开始
程序段落
done -->回圈的结束
例如:
#!/bin/bash
num=1
while [ $num -le 10 ]
do echo -e "\t the num is $num"
let num=num+1
done
运行输出:
the num is 1
the num is 2
the num is 3
the num is 4
the num is 5
the num is 6
the num is 7
the num is 8
the num is 9
the num is 10
相关文章推荐
- Shell学习笔记(10)-流程控制之while语句
- Linux学习之Shell--第五天:Shell流程控制-循环语句while
- [学习笔记]for、while、do-while 流程控制
- Shell学习笔记-流程控制
- 【转】shell学习笔记(六)——流程控制之for循环
- Shell脚本学习笔记(四)--流程控制
- Shell学习笔记(11)-流程控制之select、until语句
- Shell学习笔记(8)-流程控制之IF语句
- Shell学习笔记(13)-流程控制之函数
- Shell脚本学习笔记(四)--流程控制
- python学习笔记3—流程控制if、for、while
- Linux Bash Shell学习(十三):流程控制——while/util
- 【Linux学习笔记】Shell 基础(3) — Shell流程控制语句
- shell学习之路:流程控制(while)
- Linux学习之Shell--第五天:Shell流程控制-循环语句while
- Shell学习笔记(9)-流程控制之For语句
- java学习笔记《java面向对象编程》——流程控制
- Power Shell 学习笔记(六)流程控制语句之分支语句
- php学习笔记:第四节--php中的运算符和流程控制
- jBPM-jPDL学习笔记——流程设计与控制