引用變數時,使用 $ 符號直接來進行引用,以及包括迴圈變數;
root@sun-pc:~/桌面# x=helloworld
root@sun-pc:~/桌面# echo $x
helloworld
root@sun-pc:~/桌面# x=helloworld
root@sun-pc:~/桌面# echo "x=$x"
x=helloworld
root@sun-pc:~/桌面# x=1024
root@sun-pc:~/桌面# echo "$xxy"
1024xxy
root@sun-pc:~/桌面#
root@sun-pc:~/桌面# echo `dirname /root/name`
/root
hard quote:單引號,關閉所有的meta
root@sun-pc:~/桌面# echo '$x'
$x
Shell指令中的單引號,雙引號,反引號,反斜槓
1.string 單引號 被單引號括住的內容將被視為單一的字串,在引號內的 符號沒有作用,也就是說 被當做普通字元處理。例如 root localhost root echo home home 2.string 雙引號 被雙引號括住的內容將被視為單一的字串,他防止萬用字元擴充套件,但允許變數擴充套...
shell中單引號 雙引號 反引號
一 單引號和雙引號 首先,單引號和雙引號,都是為了解決中間有空格的問題。因為空格在linux中時作為乙個很典型的分隔符,比如string1 this is astring,這樣執行就會報錯。為了避免這個問題,因此就產生了單引號和雙引號。他們的區別在於,單引號將剝奪其中的所有字元的特殊含義,而雙引號中...
shell中單引號,雙引號,變數
variable value variable value variable value url website1 c語言中文網 website2 c語言中文網 echo website1 echo website2 執行結果 c語言中文網 c語言中文網 以單引號 包圍變數的值時,單引號裡面是什麼就...