Bash中引号的作用:保护字符串中的特殊字符不被shell或者shell脚本重新解释或扩展
ls -l [Vv]* #列出以V或v开头的文件名
ls -l '[Vv]*' #不能运行
1.使用” “来防止单词分割,如果在参数列表中使用双引号,将使双引号中的参数作为一个参数:
variable1=”a variable containing five words“
COMMAND This is $variable1
#COMMAND将以7个参数来执行
"This" "is" "a" "variable" "containing" "five" "words"
COMMAND "This is $variable1"
#COMMAND将以1个参数来执行
"This is a variable containing five words"
2.单引号中不允许引用变量,$无效、单引号比双引号严格
3.转义字符:
/n 换行
/r 回车
/t Tab键
/v 垂直Tab
/b backspace
/a "alert"(如beep或flash)
/0xx 转换成8进制