在继续之前,我需要在 shell 脚本上暂停以显示警告。例如,在 DOS 上它是这样的:
doit.bat:
[...]
echo 'Are you sure? Press Ctrl-C to abort, enter to continue.'
pause
[...]
Run Code Online (Sandbox Code Playgroud)
我怎样才能在 bash 上做到这一点?目前, sleep 命令似乎可以解决问题,并且足够简单,但并不完全是这个想法:
文件
[...]
echo 'Are you sure? Press Ctrl-C to abort.'
sleep 3
[...]
Run Code Online (Sandbox Code Playgroud)