為什麼“bind ~/.inputrc”會導致我的右斜杠鍵(“/”)在我重新登入之前被停用?

為什麼“bind ~/.inputrc”會導致我的右斜杠鍵(“/”)在我重新登入之前被停用?

下面是我的.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 啟動時讀取的。唯一的用途是在更改檔案時載入新綁定(這不會刪除已刪除的綁定)。

相關內容