如何在继续之前暂停我的 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.
在指定时间单位时也可以使用小数;例如睡眠1.5s
One can also employ decimals when specifying a time unit; e.g. sleep 1.5s
这篇关于如何在继续之前暂停我的 shell 脚本一秒钟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文