• shell注释


    1. 单行注释

    众所周知,#  比如想要注释:echo “ni”

    # echo "ni"

    2. 多行注释:

    法一:

    : << !

    语句1

    语句2

    语句3

    语句4

    !

    例如:

    linux101:/home/wsj # sh dian
    ni
    ni
    ni
    ni
    ni
    ni

    linux101:/home/wsj # more dian
    #!/bin/ksh
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"

    :<<!
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"
    !

    法二:

    : '

    语句1

    语句2

    语句3

    语句4

    '

    例如:

    linux101:/home/wsj # sh dian
    ni
    ni
    ni
    ni
    ni
    ni

    linux101:/home/wsj # more dian
    #!/bin/ksh
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"

    : '
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"
    '

     2014-02-03-06补充:

    法三:

    if false; then

    语句1

    语句2

    语句3

    语句4

    fi

    linux101:/home/wsj # sh dian
    ni
    ni
    ni
    ni
    ni
    ni

    linux101:/home/wsj # more dian
    #!/bin/ksh
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"

    if false; then
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"
    echo "ni"
    fi

     法四:

    : << 字符  #这里的字符可以是数字或者是字符都可以

    语句1

    语句2

    语句3

    语句4

    字符                        

    2014-09-10 教师节快乐,由chaosink哥们提供补充:

    法五:

    ((0)) & {

    语句1

    语句2

    语句3

    }

     
  • 相关阅读:
    1.9
    在VS中添加lib库的三种方法
    第一章之位向量和位运算
    【转载】window下配置pthread的方法及出现问题的解决方法
    opencv环境配置问题
    box-shadow用法简介
    创建资源文件
    nhibernate Mybatisnet
    js中(function(){…})()立即执行函数写法理解
    最近项目中用到的js
  • 原文地址:https://www.cnblogs.com/jinbiaof/p/6882299.html
Copyright © 2020-2023  润新知