-bash:":事件未找到
我该如何解决这个问题的bash终端?为什么会产生!突然成为一个问题,以及需要引号似乎不再是必要的,以产生该字符串。难道我碰坏?如果让我怎么恢复成出厂设置?我敢肯定,这是正常的工作昨天
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:!:找不到事件
,这是奇怪的。
运行
set +H
将关闭其全部违规(历史扩展)功能。在此把你的〜/ .bashrc中
是一种常见的做法。
另外,你可以修改 histchars
变量来改变用来触发历史扩展(默认字符,!
),快速替换(默认情况下, ^
)和评论(默认情况下,#
)。
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.