zoukankan      html  css  js  c++  java
  • 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

    }

     
  • 相关阅读:
    一往直前!贪心法
    Longest subarray of target sum
    动态规划-最长公共子序列/最长公共子串
    Short Encoding of Words
    Spiral Matrix
    Longest Repeating Character Replacement
    伤怀之美
    宁静是一种生产力
    POJ 2524 Ubiquitous Religions 【并查集】
    POJ 1611 The Suspects【并查集】
  • 原文地址:https://www.cnblogs.com/jinbiaof/p/6882299.html
Copyright © 2011-2022 走看看