反引号位 (`) 位于键盘的Tab键的上方、1键的左方。注意与单引号(')位于Enter键的左方的区别。
在Linux中起着命令替换的作用。命令替换是指shell能够将一个命令的标准输出插在一个命令行中任何位置。
如下,shell会执行反引号中的date命令,把结果插入到echo命令显示的内容中。
[root@localhost sh]# echo The date is `date`
The date is 2011年 03月 14日 星期一 21:15:43 CST
单引号、双引号用于用户把带有空格的字符串赋值给变量事的分界符。
[root@localhost sh]# str="Today is Monday"
[root@localhost sh]# echo $str
Today is Monday
如果没有单引号或双引号,shell会把空格后的字符串解释为命令。
[root@localhost sh]# str=Today is Monday
bash: is: command not found
单引号和双引号的区别。单引号告诉shell忽略所有特殊字符,而双引号忽略大多数,但不包括$、\、`。
[root@localhost sh]# testvalue=100
[root@localhost sh]# echo 'The testvalue is $testvalue'
The testvalue is $testvalue
[root@localhost sh]# echo "The testvalue is $testvalue"
The testvalue is 100
Linux Shell 中的反引号,单引号,双引号
精选 转载
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
[oeasy]python0006_指法标准_键盘正位_你好世界_hello_world_单引号_双引号
指法入门
单引号 python 双引号 -
linux单引号 双引号 反引号 的区别
linux单引号 双引号 反引号 的区别
单引号 双引号 反引号 -
shell中单引号,双引号,反引号,不用引号的使用区别
shell定义字符串变量时字符串可以用单引号,也可以用双引号,也可以不用引号,如果无特殊情况话,三者效果一样 1.单引号和双引号的区别 str=yalong echo "The str is $str" >> The str is yalong #双引号中的$str被其值yalong替换,即双引号允许变量替换。 echo 'The str is $str' >>...
shell中引号的使用 shell中反引号的使用 shelL中单引号和双引号的区别 shell编程 shell