On 9/19/25 2:20 AM, [email protected] wrote:

If we add to each of them the `-d ""' option, then:

`read -d "" -t $nonzero' will slurp in all outstanding keys, regardless of
whether or not the RETURN key has been pressed.

OK, I'll bite. There's no portable way to determine `all' here, so you are
left to poll/select with a zero timeout to see if there is input available,
then do single-character reads until the select indicates there's no more
pending input. You can do this from the shell level if you like.

while read -t 0; do
        read -N 1 v
        var+=v
done

`Wasteful' or not, it's something you can try out today.

--
``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/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

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

Reply via email to