On 9/22/25 12:28 PM, [email protected] wrote:
> while read -t 0; do > read -N 1 v > var+=v > doneNo, 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.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature
