On 9/17/25 12:02 PM, [email protected] wrote:
As a side question, wouldn't it make more sense if read -d"" -t 0
makes the read in raw mode?

What would that do to change things? (I assume that you mean a non-
blocking read; `raw mode' has historically meant something different.)

 Or is it carved in stone for historical
reasons? If so, then couldn't we maybe some time in the future get
a new "-T 0" option that could do a read in raw mode? Because, as
things are now, one has no way to check from within a tight loop
whether some key has been pressed -- not without a wasteful timeout
option, or without an expensive external call to set the term raw.

So you're worried about what is essentially typeahead into the kernel's
input buffer? If there really is typeahead there, `read -t 0', which
uses select or FIONREAD, will tell you. Then you can choose how to
handle it, probably by reading one character.

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