while(liunx,unix)中的循环执行某程序用法

while是用在循环执行某程序
格式1:
while 条件;
do
语句
done

格式2:
while true/:/[1]/[0]
do
语句
done

示范1:
COUNTER=0  
while [  $COUNTER -lt 10 ]; do  
    echo The counter is $COUNTER  
    let COUNTER=COUNTER+1   
done
结果1:
The counter is 0
The counter is 1
The counter is 2
The counter is 3
The counter is 4
The counter is 5
The counter is 6
The counter is 7
The counter is 8
The counter is 9

 示范2:
while true
do
date
sleep 3
done
结果2:
Mon Apr 29 23:51:08 CST 2013
Mon Apr 29 23:51:11 CST 2013
Mon Apr 29 23:51:14 CST 2013
Mon Apr 29 23:51:17 CST 2013
Mon Apr 29 23:51:20 CST 2013
Mon Apr 29 23:51:23 CST 2013

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26148431/viewspace-759537/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/26148431/viewspace-759537/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值