1)、單引號屬於強引用,它會忽略所有被引起來的字符的特殊處理,被引用起來的字符會被原封不動的使用,唯一需要注意的點是不允許引用自身;
2)、雙引號屬於弱引用,它會對一些被引起來的字符進行特殊處理,主要包括以下情況:
1:$加變量名可以取變量的值 ,比如:
[root@localhost ~]# echo '$PWD'
$PWD
[root@localhost ~]# echo "$PWD"
/root
2:反引號和$()引起來的字符會被當做命令執行後替換原來的字符,比如:
[root@localhost ~]# echo '$(echo hello world)'
$(echo hello world)
[root@localhost ~]# echo "$(echo hello world)"
hello world
[root@localhost ~]# echo '`echo hello world`'
`echo hello world`
[root@localhost ~]# echo "`echo hello world`"
hello world
3:當需要使用字符($ ` " \)時必須進行轉義,也就是在前面加\ ;
[root@localhost ~]# echo '$ ` " \'
$ ` " \
[root@localhost ~]# echo "\$ \` \" \\"
$ ` " \