linux 中echo 命令输出感叹号

 

001、直接使用双引号输出

[root@pc1 test2]# echo "hello world!"       ## 双引号输出感叹号报错
-bash: !": event not found

 

 

002、测试转义字符

[root@pc1 test2]# ls
[root@pc1 test2]# echo "hello world\!"     ## 直接输出了转义字符
hello world\!

 

 

003、测试单引号

[root@pc1 test2]# ls
[root@pc1 test2]# echo 'hello world!'
hello world!

 

 

004、不使用任何符号

[root@pc1 test2]# ls
[root@pc1 test2]# echo hello world!
hello world!

 

posted @ 2023-01-05 15:51  小鲨鱼2018  阅读(538)  评论(0编辑  收藏  举报