![为什么“bind ~/.inputrc”会导致我的右斜杠键(“/”)在我重新登录之前被禁用?](https://linux22.com/image/36074/%E4%B8%BA%E4%BB%80%E4%B9%88%E2%80%9Cbind%20~%2F.inputrc%E2%80%9D%E4%BC%9A%E5%AF%BC%E8%87%B4%E6%88%91%E7%9A%84%E5%8F%B3%E6%96%9C%E6%9D%A0%E9%94%AE%EF%BC%88%E2%80%9C%2F%E2%80%9D%EF%BC%89%E5%9C%A8%E6%88%91%E9%87%8D%E6%96%B0%E7%99%BB%E5%BD%95%E4%B9%8B%E5%89%8D%E8%A2%AB%E7%A6%81%E7%94%A8%EF%BC%9F.png)
下面是我的.inputrc
文件。为什么在调用 后bind ~/.inputrc
,我的右斜杠键被禁用,直到我注销并再次登录?
# Key-bindings for the command-line editor.
# Ask before displaying >50 items
# Since $WINDIR $PATH var can be in $PATH, this could list
# all window exectables in C:\WINDOWS
set completion-query-items 50
# Ignore case for the command-line-completion functionality
# on: default to a Windows style console
# off: default to a *nix style console
set completion-ignore-case on
# none, visible or audible
set bell-style audible
# disable/enable 8bit input
set meta-flag on
set input-meta on
set output-meta off
set convert-meta on
# visible-stats
# Append a mark according to the file type in a listing
set visible-stats off
set mark-directories on
# Show all instead of beeping first
set show-all-if-ambiguous on
"\e[1~": beginning-of-line #HOME
"\e[4~": end-of-line #END
"\e[A":history-search-backward #UP
"\e[B":history-search-forward #DOWN
答案1
因为bind ~/.inputrc
是绑定键序列的命令,/home/aliteralmind/inputrc
其中/home/aliteralmind
是您的主目录。这会绑定/
到未定义绑定的前缀键,因此按此/
键后不会执行任何操作。
要从 bash 读取 readline 文件,请使用
bind -f ~/.inputrc
不过,这个特定的示例并不是很有用,因为~/.inputrc
它是在 bash 启动时读取的。唯一的用途是在更改文件时加载新绑定(这不会删除已删除的绑定)。