回声"#&QUOT!;失败 - "事件未发现" [英] echo "#!" fails -- "event not found"

查看:154
本文介绍了回声"#&QUOT!;失败 - "事件未发现"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下失败,我不明白为什么:

The following fails and I don't understand why:

$ echo "#!"

下面还失败,相同的错误消息:

the following also fails with the same error message:

$ echo "\#!"

错误消息:

-bash: !": event not found

为什么会失败?应如何回声来代替呢?

推荐答案

字符用于 CSH 风格历史扩展。

The ! character is used for csh-style history expansion.

如果您不使用此功能,设置+ O histexpand (又名设置+ H )关闭此行为。它是关闭的脚本,但往往启用交互使用。

If you do not use this feature, set +o histexpand (aka set +H) turns off this behavior. It is turned off for scripts, but often enabled for interactive use.

作为一种变通方法,您可以使用单引号代替双引号的。

As a workaround, you can use single quotes instead of double quotes.

这篇关于回声"#&QUOT!;失败 - "事件未发现"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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