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

  

原文地址:https://www.cnblogs.com/leonarcohen/p/6155307.html