for循环

#!/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..

posted @ 2015-02-12 14:36  vv2013  阅读(128)  评论(0编辑  收藏  举报