bug-bash
[Top][All Lists]
Advanced

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

Re: CORRECTED: Bug in the read command


From: pourko2
Subject: Re: CORRECTED: Bug in the read command
Date: Wed, 24 Sep 2025 16:40:03 +0200 (CEST)

On Tue, 23 Sep 2025 11:28:05 -0400, Chet Ramey wrote:
> >  > while read -t 0; do
> >  >         read -N 1 v
> >  >         var+=v
> >  > done
> > 
> > No, your snippet won't detect anything if keys have been typed in but the
> > RETURN key has no been pressed yet.
> 
> Yes, you're right. The problem is that the test for pending input happens
> before (or without) the terminal settings change that would take place
> before a read when -n/-N/-d are supplied.
> 
> I think it's reasonable to change the terminal settings before testing for
> available input if those options are supplied.

This is precisely what I would like. Thank you.




reply via email to

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