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

Francis Grizzly Smit grizzly at smit.id.au
Mon Jun 29 12:02:57 UTC 2020


On 29/06/2020 21:32, 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?
>
As I recall bash has it own stuff for doing this like set -o vi for vi
key bindings
from man bash:

       INPUTRC
              The filename for the readline startup file, overriding the
default of ~/.inputrc (see
              READLINE below).

:
:
   Readline Initialization
       Readline is customized by putting commands in an initialization 
file  (the  inputrc  file).
       The  name of this file is taken from the value of the INPUTRC
variable.  If that variable is
       unset, the default is ~/.inputrc.  When a program which uses the
readline library starts up,
       the initialization file is read, and the key bindings and
variables are set.  There are only
       a few basic constructs allowed in the readline initialization
file.   Blank  lines  are  ig‐
       nored.   Lines  beginning  with  a # are comments.  Lines
beginning with a $ indicate condi‐
       tional constructs.  Other lines denote key bindings and variable
settings.

       The default key-bindings may be changed with an inputrc file. 
Other programs that use  this
       library may add their own commands and bindings.

       For example, placing

              M-Control-u: universal-argument
       or
              C-Meta-u: universal-argument
       into the inputrc would make M-C-u execute the readline command
universal-argument.

       The  following symbolic character names are recognized: RUBOUT,
DEL, ESC, LFD, NEWLINE, RET,
       RETURN, SPC, SPACE, and TAB.

       In addition to command names, readline allows keys to be bound to
a string that is  inserted
       when the key is pressed (a macro).

So you could unset INPUTRC it that way by default on my Ubuntu box

-- 

   .~.     In my life God comes first....
   /V\         but Linux is pretty high after that :-D
  /( )\    Francis (Grizzly) Smit
  ^^-^^    http://www.smit.id.au/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20200629/e158330b/attachment.html>


More information about the ubuntu-users mailing list