(())運算子
語法:((表示式1,表示式2…))
特點:1、在雙括號結構中,所有表示式可以像c語言一樣,如:a++,b--等。
2、在雙括號結構中,所有變數可以不加入:「$」符號字首。
3、雙括號可以進行邏輯運算,四則運算
4、雙括號結構 擴充套件了for,while,if條件測試運算
5、支援多個表示式運算,各個表示式之間用「,」分開
((a=a+1));((a++))
set
#!/bin/bash
set -x //開啟除錯(開啟xtrace等)
echo "test"
set -o //查詢除錯的狀態(root可以 cmd執行,其他使用者需要放到指令碼中執行)
set +x //關閉除錯
-------
執行:bash test.sh
輸出:+ echo test
test
+ set -o
allexport off
braceexpand on
emacs off
errexit off
errtrace off
functrace off
hashall on
histexpand off
history off
ignoreeof off
interactive-comments on
keyword off
monitor off
noclobber off
noexec off
noglob off
nolog off
notify off
nounset off
onecmd off
physical off
pipefail off
posix off
privileged off
verbose off
vi off
xtrace on
+ set +x
日誌常用追加:
>$ 2>&1
>>$
日誌常用清空:
suse:/home/wb/shell # sh test.sh
test
test.sh: line 4: 123: command not found
suse:/home/wb/shell # sh test.sh > /dev/nul
test.sh: line 4: 123: command not found
suse:/home/wb/shell # sh test.sh> /dev/nul 2>&1
suse:/home/wb/shell #
SHELL學習筆記(1)
第二章入門 1.wc 字數計算次序 可以列印出行數,字元數,字數等,分別為wc l or wc c or wc w 2.shell可以識別三種命令 內建命令,shell函式和外部命令 3.the usage of echo r 回車 t 水平製表符 v 垂直製表符 a 警示 b 退格 c 這個引數之...
shell學習筆記(1)
shell是c語音編寫的指令碼語言,使用者輸入命令交給shell處理,shell將操作交給核心,核心把處理結果交給使用者。編寫第乙個shell指令碼 在home目錄下新建乙個test.s 件 bin bash echo hello 儲存後可以用source test.sh即可執行指令碼輸出hello...
shell程式設計學習筆記(1)
最近突然不忙了,想系統的學習一下shell程式設計。可以說對linux的熟悉離不開對shell的學習,而作為乙個好的系統管理員,不能不懂shell程式設計。shell程式設計不只是簡單的命令堆疊,它還提供了變數,控制結構 if for while 可以說它和python perl ruby等3大腳步...