Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-bash: !": event not found [closed]

How do I fix this bash terminal? Why would the '!' suddenly be a problem and the need for quotation marks are no longer seem to be necessary to produce the string. Did I break something? If so how do I reset it to factory setting? I'm sure it was working properly yesterday

Last login: Sat Oct 18 15:30:48 on ttys001
Michels-MacBook-Pro:~ michelfrechette$ echo "hello, world!"
-bash: !": event not found
Michels-MacBook-Pro:~ michelfrechette$ echo hello, world
hello, world
Michels-MacBook-Pro:~ michelfrechette$ echo "hello, world"
hello, world 

-bash: !": event not found, this is curious.

like image 912
Michel Frechette Avatar asked Oct 18 '14 19:10

Michel Frechette


1 Answers

Running

set +H

will turn off the offending (history expansion) functionality in its entirety. Putting this in your ~/.bashrc is a common practice.

Alternately, you can modify the histchars variable to change the characters used to trigger history expansion (by default, !), quick substitution (by default, ^) and comments (by default, #).

As yet another option, using single- rather than double-quotes avoids triggering the shell feature in question.

like image 53
Charles Duffy Avatar answered Oct 14 '22 01:10

Charles Duffy