本文介绍了如何逃避bash中的感叹号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时候,我感到渴望在git commit消息中增加一些表现力.不幸的是bash似乎不喜欢这样.

Sometimes I feel the urge to put some more expressiveness in my git commit messages. Unfortunately bash does not seem to like this.

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

使用反斜杠转义会有所帮助,但这会在提交消息中包含反斜杠.

Escaping with a backslash helps, but this includes the backslash in the commit message.

如何正确避开bash中的感叹号?

How do I escape the exclamation mark in bash correctly?

推荐答案

将感叹号包含在单引号引起的字符串中时,它会按原样保留.

Exclamation mark is preserved literally when you include it in a single-quoted string.

示例:

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

这篇关于如何逃避bash中的感叹号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 08:26