如何在Linux bash shell中转义bang(!)字符? [英] How to escape the bang (!) character in Linux bash shell?

查看:95
本文介绍了如何在Linux bash shell中转义bang(!)字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一生无法解决如何在Bash中转义!字符.例如,我要打印此:

I cannot for the life of me figure out how to escape the ! character in Bash. For example, I want to print this:

Text text text!

我已经尝试过了:

echo "Text text text\!"

但是会打印出来:

Text text text\!

(带有反斜杠).

我该怎么做?

推荐答案

尝试一下:

 echo 'Text text text!'

 echo "Text text text"'!'

 echo -e "Text text text\x21"

这篇关于如何在Linux bash shell中转义bang(!)字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆