在继续之前,我需要在 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)
Huc*_*kle 11
类似的东西
echo -n "prompt" #'-n' means do not add \n to end of string
read # No arg means dump next line of input
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
27901 次 |
| 最近记录: |