gpt4 book ai didi

bash - 如何在 bash 中转义感叹号?

转载 作者:行者123 更新时间:2023-11-29 08:51:54 24 4
gpt4 key购买 nike

有时,我有一种冲动,想在我的 git 提交消息中添加更多表现力。不幸的是,bash 似乎不喜欢这样。

iblue@silence ~/git/wargames $ git commit -m "Frustrating <insert object of frustration here>!"
-bash: !": event not found

使用反斜杠转义会有所帮助,但这包括提交消息中的反斜杠。

如何正确转义 bash 中的感叹号?

最佳答案

当您将感叹号包含在单引号字符串中时,它会按字面意思保留。

例子:

git commit -m 'Frustrating <insert object of frustration here>!'

关于bash - 如何在 bash 中转义感叹号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11025114/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com