zoukankan      html  css  js  c++  java
  • 【转】shell学习笔记(七)——流程控制之while

    while do done, until do done (不定回圈)

    当 condition 条件成立时,就进行回圈,直到 condition 的条件不成立才停止

    while [condition]    -->中括号内的状态就是判断式

    do                            -->回圈的开始

         程序段落     

    done                        -->回圈的结束

    例如:
    #!/bin/bash
    num=1
    while [ $num -le 10 ]
    do     echo -e " the num is $num"
        let num=num+1
    done
    运行输出:
     the num is 1
     the num is 2
     the num is 3
     the num is 4
     the num is 5
     the num is 6
     the num is 7
     the num is 8
     the num is 9

     the num is 10

  • 相关阅读:
    interview
    lvs简介
    编译参数说明
    nginx-arch
    network
    linux 密码修改方法
    ps命令详解
    sed 命令+正则表达式
    LINUX SCP 命令详解
    linux下mysql的root密码忘记解决方
  • 原文地址:https://www.cnblogs.com/xiongyunqi/p/3735839.html
Copyright © 2011-2022 走看看