在继续之前,如何暂停我的Shell脚本一秒钟? [英] How do I pause my shell script for a second before continuing?
本文介绍了在继续之前,如何暂停我的Shell脚本一秒钟?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只发现了如何等待用户输入.但是,我只想暂停一下,这样我的while true
不会使计算机崩溃.
I have only found how to wait for user input. However, I only want to pause so that my while true
doesn't crash my computer.
我尝试了pause(1)
,但显示为-bash: syntax error near unexpected token '1'
.怎么办?
I tried pause(1)
, but it says -bash: syntax error near unexpected token '1'
. How can it be done?
推荐答案
使用sleep
命令.
示例:
sleep .5 # Waits 0.5 second.
sleep 5 # Waits 5 seconds.
sleep 5s # Waits 5 seconds.
sleep 5m # Waits 5 minutes.
sleep 5h # Waits 5 hours.
sleep 5d # Waits 5 days.
在指定时间单位时,也可以使用小数;例如sleep 1.5s
One can also employ decimals when specifying a time unit; e.g. sleep 1.5s
这篇关于在继续之前,如何暂停我的Shell脚本一秒钟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文