shell循环for-while-seq

1
2
3
4
5
6
#!/bin/sh
while :;do
   ((++i))
   echo $i
((i==100))&&break
done
1
2
3
4
#!/bin/sh
for i in {1..100};do
   echo $i
done
1
2
3
4
5
6
#!/bin/sh
i=1
while [ $i -le 100 ];do
   echo $i
   i=$(($i+1))
done

如果单纯只是数字的话,seq最简单..
seq 1 100
http://baiqiuyi.com/linux/shell-loop-while-for-and-seq.html