有时,我有一种冲动,想在我的 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/