首页 > 代码库 > shell脚本之while

shell脚本之while

#! /bin/bash
echo if num smaller than 5,it will continue 
num=0
while [ $num -lt 5 ]
do
echo now the num is $num
let num++
done

  

[root@lenny Desktop]# ./while.sh 
if num smaller than 5,it will continue
now the num is 0
now the num is 1
now the num is 2
now the num is 3
now the num is 4

  

shell脚本之while