What is the Linux equivalent to DOS pause?

前端 未结 9 563
猫巷女王i
猫巷女王i 2020-11-30 16:15

I have a Bash shell script in which I would like to pause execution until the user presses a key. In DOS, this is easily accomplished with the \"pause\" command. Is there a

9条回答
  •  醉话见心
    2020-11-30 17:01

    If you just need to pause a loop or script, and you're happy to press Enter instead of any key, then read on its own will do the job.

    do_stuff
    read
    do_more_stuff
    

    It's not end-user friendly, but may be enough in cases where you're writing a quick script for yourself, and you need to pause it to do something manually in the background.

提交回复
热议问题