閱讀789 返回首頁    go 技術社區[雲棲]


linux shell 指令好記速查

    1.訪問變量要加$ 

        a=100

        echo $a

    2.read a #將用戶輸入內容放入a

    3.參數

        $0 腳本名字,$# 參數個數,$$ shell腳本進程號,$1...$n 具體參數

        $*,$@ 全部參數,前者以$IFS分隔

    4.test或者[]

        if test -f xxx.c;then   #or [ -f xxx.c ]

        ...

        fi

    5.if [cond0] || [cond1] && [cond2];then elif else  fi

    6.for i in ... do ... done

    7.while cond do ... done

    8.until cond do ... done

    9.case val in 

        cond1_a | cond1_b) ...;;

        cond2)...;;

        esac

    10.多個語句 {}

    11.函數 foo() {local xxx = xxx;return xxx}

    12.break,continue,

    13, :號 , true的別名

    14. 符號.在當前shell中執行命令

    15.對參數求值 eval

    16.exec將當前shell換為其他程序

    17.expr將參數作為表達式求值

    18.set|unset為shell設置|刪除參數變量

    19.shift將所有參數左移一位

    20.trap信號處理

    21.find [path] [options] [tests] [actions]

    22.$()|``將命令以字符串方式返回

    23.$((...)),${}參數擴展

    24.$?上一命令的退出狀態

最後更新:2017-04-04 07:03:25

  上一篇:go Android: Gallery的adapter中getView方法被執行多次
  下一篇:go android Handler應設為static