linux 系统中 双引号“”和单引号‘’转义的区别

 

双引号“”:不进行转义,保留变量属性。

单引号‘’:进行转义,使其成为单纯的字符串。

[root@localhost test]# A=10  
[root@localhost test]# echo $A
10
[root@localhost test]# echo "number is $A"   ## 双引号不进行转义, 保留变量属性
number is 10
[root@localhost test]# echo 'number is $A'   ## 单引号进行转移,转义为单纯字符串
number is $A

 

posted @ 2022-03-27 21:51  小鲨鱼2018  阅读(3204)  评论(0编辑  收藏  举报