bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bind command dies on bad syntax


From: Chet Ramey
Subject: Re: bind command dies on bad syntax
Date: Fri, 8 Jan 2016 08:52:05 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.5.0

On 1/7/16 9:16 AM, Andrew Kurn wrote:

> Bash Version: 4.3
> Patch Level: 30
> Release Status: release
> 
> Description:
> When I put an extra space in the bind command, it fails silently
> and corrupts the keyboard map.  Lower-case h no longer works.
> 
> Repeat-By:
> bind Control-a: forward-search-history

OK, let's unpack this.  First, this is two separate key bindings, since
word splitting results in two arguments.

The first one easy: it binds C-a to nothing.  You specify a key binding,
but no command to bind it to.

The second is a little more confusing.  The key name to be bound is
whatever appears following the final hyphen (in this case, `history').
(The strings before the final hyphen are assumed to be modifiers, but
unknown modifiers are ignored.)  That string doesn't match any of the key
names readline treats specially, so it assumes you want to bind the first
character of the string (`h').  Since you don't provide a readline command
to bind to, it gets bound to nothing.

The reasons for this kind of `forgiving' key binding syntax have been lost
over the last 27 years.  I'll see what I can do to improve error reporting
here.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]