分类:
2011-01-19 12:09:58
1 2 3 | for i in ` seq 1 100`; do echo $i done |
1 2 3 | for ((i=1;i<100;i++)); do echo $i done |
1 2 3 4 5 | i=1 while (($i<100)); do echo $i i=` expr $i + 1` done |
i=`expr $i + 1`还可以改为i=$(($i+1))加快运算速度(看shell支持与否)
1 2 3 | for i in {1..100}; do echo $i done |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #!/bin/bash #print the route rulers for cczu #to make this take effect ,pass it to shell with a pipe #eg: route-cczu.sh |sh #via:ihipop@gmail.com igw=219.230.149.1 for ip in {144..159}; do echo route add -net 219.230.$ip.0 netmask 255.255.255.0 gw $igw dev eth0 done for ip in {65..70}; do echo route add -net 211.65.$ip.0 netmask 255.255.255.0 gw $igw dev eth0 done for ip in ` seq 1 65`; do echo route add -host 211.65.64.$ip gw $igw dev eth0 done for ((ip=16;ip<=20;ip++)); do echo route add -net 172.$ip.0.0 netmask 255.255.0.0 gw $igw dev eth0 done |
chmod +x route-cczu.sh
./route-cczu.sh |sh