[Top][All Lists]

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

Re: What exactly does "read -e" do? bind weirdnesses

From: Chet Ramey
Subject: Re: What exactly does "read -e" do? bind weirdnesses
Date: Thu, 25 Sep 2008 15:49:12 -0400
User-agent: Thunderbird (Macintosh/20080707)

Rocky Bernstein wrote:
> On Tue, Sep 23, 2008 at 8:46 AM, Chet Ramey <address@hidden> wrote:
>> Rocky Bernstein wrote:
>>> Sorry for the delayed reply.
>>> As I now understand it, the situation right now seems a bit
>>> inconsistent. "read -e" in a script uses emacs bindings by default even
>>> if I've entered "set -o emacs" which I note in the following example:
>> (I'm assuming you mean `set +o emacs'.)
> Yes you are correct I meant "set +o emacs". But I added that line just
> to be every explicit and to see how it changed read, if at all.
> (Answer: none). The program has the same effect if "set +o emacs"
> didn't exist.

True enough, since line editing is not enabled by default when the shell
is not interactive.

>>> But the behavior of "bind -p" is to show nothing, and possibly in the
>>> future to give an error saying that "line editing" is not on. And this
>>> seems inconsistent. In the context of a script, if "bind -p" isn't
>>> reporting on what happens in "read -e", then what is it reporting on?

bind -p is reporting on the current key bindings at the instant it is
invoked.  If line editing is not enabled, it should mean that none of
the key bindings it would report on will have any effect.  It's not going
to guess that at some future point the user may invoke `read -e' and ask
for line editing.  At that point, the key bindings and defaults will be
as they are specified in the bash documentation.

It's not unreasonable that bind work when line editing is not enabled,
just printing a warning to that effect before going on.  That would
probably satisfy your needs.  I will consider that for the next version.

``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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