[英]Bash bind command
I have a very curious situation, when logged n terminal to my Centos host the capital r does not work, it doesn't type anything. 我有一个非常奇怪的情况,当登录到我的Centos主机的终端时,大写r不起作用,它没有输入任何内容。
It does work when i'm editing files for example. 例如,当我编辑文件时,它确实有效。
After long search of possible issue I think I found the problem is that I have no bind association for the R
, see and extract from the output of bind -p
: 经过长时间搜索可能的问题,我想我发现问题是我没有
R
绑定关联,请参阅bind -p
的输出并从中提取:
=======
"M": self-insert
"N": self-insert
"O": self-insert
"P": self-insert
"Q": self-insert
"S": self-insert
"T": self-insert
"U": self-insert
"V": self-insert
============
as you can see the "R" is missing, how do I add it? 你可以看到“R”缺失了,我该如何添加呢? please keep in mind I cannot type "R" in my terminal :)
请记住我不能在我的终端输入“R”:)
Have you tried this? 你试过这个吗?
bind '"R":self-insert'
or this, if you can't type "R": 或者,如果你不能输入“R”:
bind '"'`echo -e '\x52'`'":self-insert'
rcap=$(echo r | tr '[a-z]' '[A-Z]')
This command sets rcap
variable to R
. 此命令将
rcap
变量设置为R
Now you can use $rcap
instead of R
anywhere, eg in a command that restores the binding of R
: 现在你可以在任何地方使用
$rcap
而不是R
,例如在恢复R
绑定的命令中:
bind "$rcap":"self-insert"
Of course you can also edit a script and source it from bash
, and there you can use R
. 当然你也可以编辑一个脚本并从
bash
它,在那里你可以使用R
My guess would be that the mapping is removed somewhere. 我的猜测是在某处删除了映射。 Run
bash -x
to start a new shell and see which commands are executed while it starts. 运行
bash -x
以启动新shell并查看启动时执行的命令。
You can also try to add bind "R":"self-insert"
to your .bashrc
and start a new terminal. 您还可以尝试向
.bashrc
添加bind "R":"self-insert"
并启动新终端。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.