Bash: How to end infinite loop with any key pressed?

前端 未结 6 733
长发绾君心
长发绾君心 2020-11-30 03:16

I need to write an infinite loop that stops when any key is pressed.

Unfortunately this one loops only when a key is pressed.

Ideas please?

#         


        
6条回答
  •  执笔经年
    2020-11-30 04:00

    Usually I don't mind breaking a bash infinite loop with a simple CTRL-C. This is the traditional way for terminating a tail -f for instance.

提交回复
热议问题