Bash doesn't seem to read /etc/inputrc (or ~/.inputrc) automatically

Chris Green cl at isbd.net
Mon Jun 29 12:24:37 UTC 2020


On Mon, Jun 29, 2020 at 12:32:16PM +0100, Chris Green wrote:
> I have been trying to configure my key bindings using readline/inputrc
> and it seems to me that bash isn't reading /etc/inputrc or ~/.inputrc
> automatically.
> 
> Other programs that use readline *do* see my customised /etc/inputrc
> or ~/.inputrc, either seems to work.  However bash stubbornly ignores
> the settings in either of these files.  The default bashrc set-up sets
> INPUTRC=/etc/inputrc and I still have that setting but it doesn't seem
> to help at all.
> 
> I can obviously simply add a "bind -f /etc/inputrc" to my .profile but
> it shouldn't really be necessary.
> 
> It also appears that bash has its own, compiled in, defaults for key
> bindings, are these documented anywhere?
> 
Digging away at this I think I may have discovered the problem, for
some reason bash won't allow me to rebind CTRL-u but will allow me to
rebind (most?) other keys.

So why on earth can't I rebind CTRL-u?

Shown by the sequence of commands below:-

    chris$ bind -q end-of-line
    end-of-line can be invoked via "\C-e", "\eOF", "\e[4~", "\e[F".
    chris$ bind -r "\C-e"
    chris$ bind -q end-of-line
    end-of-line can be invoked via "\eOF", "\e[4~", "\e[F".

So we can un-bind CTRL-e without problems, but:-

    chris$ bind -r "\C-u"
    chris$ bind -q unix-line-discard
    unix-line-discard can be invoked via "\C-u".
    chris$ 

We can't unbind CTRL-u

    chris$ bind "\C-u":kill-whole-line
    chris$ bind -q unix-line-discard
    unix-line-discard can be invoked via "\C-u".
    chris$ bind "\C-e":kill-whole-line
    chris$ bind -q unix-line-discard
    unix-line-discard can be invoked via "\C-u".
    chris$ bind -q kill-whole-line
    kill-whole-line can be invoked via "\C-e".

We can't bind CTRL-u to kill-whole-line but we *can* bind CTRL-e to
kill whole line. 

What's preventing rebinding/changing CTRL-u?


-- 
Chris Green




More information about the ubuntu-users mailing list