linux中国网

linux菜菜鸟的日记

shell循环for-while-seq(转)

| 暂无评论

shell循环for-while-seq

#!/bin/sh
while :;do
   ((++i))
   echo $i
((i==100))&&break
done
#!/bin/sh
for i in {1..100};do
   echo $i
done
#!/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

发表评论

*为必填字段!