bug-bash
[Top][All Lists]
Advanced

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

Re: read -ei "y" -p "> " bug(s)


From: Greg Wooledge
Subject: Re: read -ei "y" -p "> " bug(s)
Date: Mon, 16 Jan 2012 08:39:06 -0500
User-agent: Mutt/1.4.2.3i

On Fri, Jan 13, 2012 at 09:49:56PM -0800, Linda Walsh wrote:

> BASH_VERSION = 4.1.10(1)-release

> I wanted to be able to check the keyboard if the user had 'typed' ahead,

read -t 0

> I wanted to do a
>   read -t 0.01 pre_ans
> 
> just before my read to see if there was input already available and 
> scarf it up..

No, read -t 0 was created for this purpose, and is available in bash 4.0
and higher, which you have.

> if you use read -N 1,
> 
> on future lines that I would 'edit' (in vimode), CR would be entered as 
> input , but would
> not recognized as 'enter line'... only ^j worked actually execute the 
> line...

I cannot reproduce this behavior as you state it.  (I assume you are
saying that you type "read -N 1", then press a key, then at a new prompt
you type something, then press ESC, then press v, then move the cursor
around, then press Enter.  When I do that, Enter works as expected.)

> The terminal wasn't in 'raw' mode... output was unchanged, just that CR 
> was no longer
> taken for entry.   erase and such still worked normally...

Well, it certainly *sounds* as though you had somehow managed to perform
the equivalent of "stty -icrnl".  (Although, on my system, even that
won't break the Enter key in bash.  Just in ssh.  See below.)

> I did an output of stty -a of a working window and a non working one, 
> the settings
> are the same!

That's odd.

The only way I can come close to the behavior you describe is to run
"stty -icrnl".  In bash, in my terminal, this produces no immediately
noticeable difference -- the Enter key still works to submit commands
to bash.  However, if I run something like "ssh localhost", and get a
password prompt from ssh, then the Enter key no longer works and I have
to press Ctrl-J.  Which is precisely what I'd expect, from having typed
"stty -icrnl".

But "read -N 1" does not do this for me -- no change in stty settings,
no change in bash behavior, no change in ssh behavior.  I tried in both
bash 4.2 and bash 4.1.

Can you tell us precisely, step by step, mouse click by mouse click and
keystroke by keystroke, how to reproduce your issue?  Include what OS you
are on, and what terminal you are in.



reply via email to

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