Shell until循环
2017-03-28 13:43
288 查看
until 循环执行一系列命令直至条件为 true 时停止。until 循环与 while 循环在处理方式上刚好相反。一般while循环优于until循环,但在某些时候,也只是极少数情况下,until 循环更加有用。
until 循环格式为:
例如,使用 until 命令输出 0 ~ 9 的数字:
until 循环格式为:
until command do Statement(s) to be executed until command is true donecommand 一般为条件表达式,如果返回值为 false,则继续执行循环体内的语句,否则跳出循环。
例如,使用 until 命令输出 0 ~ 9 的数字:
#!/bin/bash a=0 until [ ! $a -lt 10 ] do echo $a a=`expr $a + 1` done运行结果:
0 1 2 3 4 5 6 7 8 9
相关文章推荐
- Shell的while循环和until循环
- shell脚本学习9——循环指令:for、while、until
- Shell中的循环语句for、while、until实例讲解
- Shell until循环
- shell浅谈之三for、while、until循环
- Shell 学习19 - Shell until 循环
- 28_Shell语言――while和until循环(while, until, sleep)
- 一文读懂Shell脚本中循环语句for,while,until用法
- Shell脚本基础18-until循环
- Shell until循环
- Shell中的循环语句for、while、until
- shell之循环 (for、while、until)
- Linux 下的 shell 编程之 until 循环
- linux 中的shell while/until循环及数字的对比
- Shell中的循环语句for、while、until实例讲解
- shell的until循环
- shell 脚本 之循环 for while until 和 软件包的管理 【上】
- shell基础之三:循环语句for,while,until
- shell浅谈之三for、while、until循环
- shell里的until循环