![]() That or dd doesn't time-out because you press a key - in which case an interactive shell is invoked. Every two seconds dd times out on its attempted read of stdin - redirected from /dev/tty - and the while loop loops. That is a little example while loop that I mocked-up for you to try out. Combine those two and you can do without sleep entirely, I think, and just let the terminal's read timeout do the work for you: s=$(stty -g /dev/null stty "$s")" || (exec sh)ĭo echo "$SECONDS:" do your stuff here maybe With stty you can set a min number of bytes to qualify a terminal read and a time out in tenths of a second. ![]() With dd you can reliably read a single byte from a file.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |