How to avoid exclamation mark in bash?

Sometimes I feel like expressing some expressiveness in git commit messages. Unfortunately, bash does not seem to like it.

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

Backslash escaping helps, but it includes a backslash in the commit message.

How to avoid the correct exclamation mark in bash?

+6
source share
3 answers

The exclamation point is literally saved when you include it in a single quote string.

Example:

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

Instead of preventing use, use single quotes.

+6
source

Try this one

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

If in the middle of the line, then

"hello"'!'"world"

+4
source

Source: https://habr.com/ru/post/918047/


All Articles