在Shell中引号分为3种:单引号,双引号和反引号。 1.单引号 由单引号括起来的字符都作为普通字符出现。特殊字符用单引号括起来以后,也会失去原有意义,而只作为普通字符解释。例如: $ echo 'My current dir is `pwd` and logname is $logname' $ My current dir is 'pwd' and logname is $logname 2.双引号 由双引号括起来的字符,除$ 例如: $ logname=sunke $ echo "My current dir is `pwd` and logname is $logname" $ My current dir is /home/sunke and logname is sunke 我们假定PATH的值为.:/usr/bin:/bin,输入如下命令: # String="$PATH\\\"\$PATH" # echo $TestString .:/usr/bin:/ bin\"$PATH 读者可以自己试一下在第二个双引号之前不加 会产生什么结果。 3.倒引号 $ current directory is /home/abc |
|
来自: 昵称13511140 > 《linux》