until命令刚好与while命令相反,until命令需要制定一条测试命令,这条命令通常产生一个非0的退出状态,只要测试命令的退出状态非0,bash shell就会执行列在循环中的命令,一旦测试条件返回0退出状态,循环停止! until格式命令: until test commands do other conmands done 示例: #!/bin/bash var1=10 until [ $var1 -eq 0 ] do echo $var1 var1=$[ $var1 -2 ] done [root@localhost ~]# ./test12.sh 10 8 6 4 2
12-05
512
05-28
05-30
220
09-16
1477
03-08
448