如何使用 bash 脚本重新加载 .inputrc?

FMc*_*FMc 32 bash readline inputrc

这个问题解释了如何.inputrc使用C-x C-r. 但是如何使用 bash 脚本中的命令重新加载它呢?

cYr*_*rus 38

使用bind命令:

bind -f ~/.inputrc
Run Code Online (Sandbox Code Playgroud)

有关help bind更多信息,请参见:

bind -f ~/.inputrc
Run Code Online (Sandbox Code Playgroud)

  • 这不会解除已删除条目的绑定。 (2认同)
  • 我有点惊讶地看到 `-f` 选项只接受一个 **filename**,而不是一个文件,这意味着,例如,`bind -f <(cat ~/.inputrc)` 没有效果. 我在尝试将单个 `set` 行传递给 `bind -f` 时遇到了这个问题。 (2认同)