首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >bash inputrc不会加载

bash inputrc不会加载
EN

Unix & Linux用户
提问于 2020-12-16 14:03:17
回答 1查看 193关注 0票数 2

我创建了~/..inputrc,在bash读行中看不到它的任何效果。

$ bind -f ~/.inputrc既不显示错误,也不加载文件。

$INPUTRC是未设置的,如果我在~/..bashrc中设置了export INPUTRC=~/.inputrc并重新启动bash,那么没有什么变化。

$ strace bash的输出中搜索inputrc以验证读取的发生:

代码语言:javascript
复制
openat(AT_FDCWD, "/home/me/.inputrc", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0664, st_size=1900, ...}) = 0
read(3, "# ~/.inputrc\n#\n# bash configurat"..., 1900) = 1900
close(3)                                = 0

$ bind -v | grep completion-ignore-case的输出,我的.inputrc打开了,但是绑定显示它仍然关闭:

设置完成-忽略-关闭

$ bind -p | grep -e C-q的输出应该显示我的.inputrc重新定义了control,但是bind显示:

"\C-q":引文-插入

我的输入文件:

代码语言:javascript
复制
# ~/.inputrc
#
# bash configuration file
# See readline(3readline) and `info rluserman' (readline llibrary) for more information.
#
# set VARIABLE VALUE
# KEY-NAME: "MACRO"
# KEY-NAME: COMMAND
#
# Note: Keystrokes like \015 or \C-m (return) may be part of MACRO
#
# \C-KEY = Control-KEY (KEY should be lower case)
# \M-KEY = Alternate-KEY (KEY should be lower case)
# \e = escape (sent by keyboard when using alternate key)
# \\ = backslash
# \" = double quote
# \' = single quote
# \a = altert bell
# \b = backspace
# \d = delete
# \f = form feed
# \n = newline (linux: line feed \x0A)
# \r = return
# \t = tab
# \v = vertical tab
# \ooo = 8 bit octal code
# \xHH = 8 bit hex codep
#
# $if
# $else
# $endif
# $include

###############
# stuff from /etc/inputrc
###############

# Be 8 bit clean.
set input-meta on
set output-meta on

# arrow key bindings
"\e[A": history-search-backward
"\e[B": history-search-forward
"\e[C": forward-char
"\e[D": backward-char

# allow the use of the Home/End keys
"\e[1~": beginning-of-line
"\e[4~": end-of-line

# allow the use of the Delete/Insert keys
"\e[3~": delete-char
"\e[2~": quoted-insert

# alternate mappings for "page up" and "page down" to search the history
# "\e[5~": history-search-backward
# "\e[6~": history-search-forward

# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving
"\e[1;5C": forward-word
"\e[1;5D": backward-word
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word

$if term=rxvt
"\e[7~": beginning-of-line
"\e[8~": end-of-line
"\eOc": forward-word
"\eOd": backward-word

###############
# my stuff
###############

set colored-stats on
set completion-ignore-case on
set completion-prefix-display-length 3
set mark-symlinked-directories on
set show-all-if-ambiguous on
set show-all-if-unmodified on
set visible-stats on

# Convert line to $"(..)"
"\C-q": "\C-a\"$(\C-e)\"\C-a"
EN

回答 1

Unix & Linux用户

回答已采纳

发布于 2020-12-16 14:32:37

我的.inputrc文件包含一个$if,但缺少一个导致忽略内容的$endif

票数 0
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/624772

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档