天天看点

bash shell for循环1到100

前言

用bash shell写程序时,经常会用到for循环,特别是从1到100这种需求,这里记录几种shell中从1到100的循环方法

类c语言:

    for ((i=1; i<=100; i ++))  

    do  

        echo $i  

    done  

in使用:

    for i in {1..100}  

seq使用:

    for i in `seq 1 100`  

本文转自leonardos51CTO博客,原文链接: http://blog.51cto.com/leomars/1917406,如需转载请自行联系原作者

继续阅读