首页 > 其他 > 详细

for循环

时间:2015-02-12 15:55:31      阅读:235      评论:0      收藏:0      [点我收藏+]

#!/bin/bash

echo "Bash version ${BASH_VERSION}"

for i in {0..10..2}

do

echo "Wellcom $i times"

done

 

 

echo "echo ‘netstat -anf | grep 8080‘"

for ((c=1;c<=5;c++))

do

echo "Wellcom aggin times... $c.."

#暂停2秒

sleep 2

done

 

打印结果:

[root@localhost bin]# ./test.sh
Bash version 4.1.2(1)-release
Wellcom 0 times
Wellcom 2 times
Wellcom 4 times
Wellcom 6 times
Wellcom 8 times
Wellcom 10 times
echo ‘netstat -anf | grep 8080‘
Wellcom aggin times... 1..
Wellcom aggin times... 2..
Wellcom aggin times... 3..
Wellcom aggin times... 4..
Wellcom aggin times... 5..

for循环

原文:http://www.cnblogs.com/zhaosj/p/4288003.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!