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