Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • Chris, what do you mean by "preloading"? Commented Sep 15 at 14:47
  • 1
    @decision-making-mike just type some stuff, so you can compare results per the question title Commented Sep 15 at 16:45
  • Actually, when I do sleep 3 ; read -t0 ; echo $?, and type something during those 3 seconds, there's 1 echoed. The same if I type nothing. I mean something like aaa. Only if I type either CTRL-D or ENTER after that aaa, there's 0 echoed. Is this the expected behavior? Commented Sep 15 at 16:55
  • bash's read -t0 does actually do a select(). In zsh, you'd use the zselect builtin instead (zselect -r0 -r0). Commented Sep 15 at 18:52
  • I mean bash's read -t0 does a select() to check whether there's any input, but, like mksh's, and unlike ksh93's or zsh's does not read() it regardless of whether select() says there is or not, so it can be used here. In the case of bash, it's documented, not in as many words in the case of mksh, so it may be unintentional there. Commented Sep 15 at 19:02