[[PageOutline]] = source = {{{ man bash }}} = 符號 = {{{ `要執行的命令` `mount | grep "update"` }}} 會執行 `` 中的命令 = 判斷式 = 0 表示正確。 1 表示錯誤。 {{{ a=11 test $a -lt 10 echo $? }}} {{{ a=$((a+1)) echo $a }}} = function = {{{ function add() { echo $1 echo $2 } add 2 4 }}} = dmesg = = unset = 將變數內容清除 {{{ b=12 echo $b unset b echo $b }}} = awk = 以空白將字串分開,第一個字串代表 $1 ,第二個字串代表 $2 {{{ dmesg | tail -n 1 | awk '{print $2}' }}} = read = {{{ read aa < "tmp" }}} 將 tmp 檔內的資料讀入 aa 內。 = whiptail = 產生對話式選單 {{{ whiptail --menu "test" 0 0 0 a1 "test a1" a2 "test a2" }}} 做一個選單,test a1 選項結果為 a1, test a2 選項結果為 a2 {{{ whiptail --menu "test" 0 0 0 a1 "test a1" a2 "test a2" 2> tmp }}} 將結果標準錯誤輸出至 tmp 內