-bash: !": 事件未找到 [英] -bash: !": event not found

查看:34
本文介绍了-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: !": event not found,这很奇怪.

推荐答案

运行

set +H

将完全关闭违规(历史扩展)功能.把它放在你的 ~/.bashrc 中是一种常见的做法.

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

或者,您可以修改 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, #).

作为另一种选择,使用单引号而不是双引号可以避免触发相关的 shell 功能.

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

这篇关于-bash: !": 事件未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆