[Techtalk] bash and inputrc

John Clarke johnc+linuxchix at kirriwa.net
Wed Jan 12 17:21:23 EST 2005


On Tue, Jan 11, 2005 at 09:34:11 -0800, Akkana Peck wrote:

> Anybody used .inputrc successfully to change bash's key bindings?

Yes.  As a test, I logged on to the only debian box I have access to
(v3.0 according to /etc/debian_version), and bound home/end to
beginning/end of line.  Before, there were two bindings to
beginning-of-line:

    [jrc at zeus ~]$ bind -P|grep beginning-of-line
    beginning-of-line can be found on "\C-a", "\eOH".

I setup my .inputrc:

    [jrc at zeus ~]$ cat > .inputrc
    "\e[H":beginning-of-line
    "\e[F":end-of-line

and loaded it:

    [jrc at zeus ~]$ bind -f .inputrc

and now the new binding is in place:

    [jrc at zeus ~]$ bind -P|grep beginning-of-line
    beginning-of-line can be found on "\C-a", "\eOH", "\e[H".

Bash does read the file on startup.  If I remove .inputrc and start a
new shell, the  new key binding is lost:

    [jrc at zeus ~]$ bind -P|grep beginning-of-line
    beginning-of-line can be found on "\C-a", "\eOH", "\e[H".
    [jrc at zeus ~]$ mv .inputrc .inputrc.save
    [jrc at zeus ~]$ bash
    [jrc at zeus ~]$ bind -P|grep beginning-of-line
    beginning-of-line can be found on "\C-a", "\eOH".

If I restore .inputrc and start another shell, the key binding comes
back:

    [jrc at zeus ~]$ mv .inputrc.save .inputrc
    [jrc at zeus ~]$ bash
    [jrc at zeus ~]$ bind -P|grep beginning-of-line
    beginning-of-line can be found on "\C-a", "\eOH", "\e[H".


Cheers,

John
-- 
For people who are supposed to be customer oriented, telco-folks
are customer-friendly in the same way that Genghis Khan was
kind to small animals.
            -- Chris "Saundo" Saunderson


More information about the Techtalk mailing list