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.