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.


    • Re: CORRECT... pourko--- via Bug reports for the GNU Bourne Again SHell
      • Re: COR... Chet Ramey
        • Re:... pourko--- via Bug reports for the GNU Bourne Again SHell
          • ... Chet Ramey
            • ... pourko--- via Bug reports for the GNU Bourne Again SHell
              • ... Chet Ramey
        • Re:... pourko--- via Bug reports for the GNU Bourne Again SHell
    • Re: CORRECT... pourko--- via Bug reports for the GNU Bourne Again SHell
  • Re: CORRECTED: B... pourko--- via Bug reports for the GNU Bourne Again SHell
  • Re: CORRECTED: B... pourko2--- via Bug reports for the GNU Bourne Again SHell

Reply via email to