sleep命令
sleep 参数
时间:指定要暂停时间的长度。
时间长度,后面可接 s 为秒,m 为 分钟,h 为小时,d 为日数。
sleep 1 :睡眠1秒
sleep 1s :睡眠1秒
sleep 1m : 睡眠1分
sleep 1h :睡眠1小时
实例
#!/bin/bash
b=' '
for ((i=0;$i<=100;i++))
do
printf "Progress:[%-100s]%d%%\r" $b $i
sleep 0.1s
b=#$b
done
有时在写一些以循环方式运行的监控脚本,设置时间间隔是必不可少的
转载于:https://blog.51cto.com/13442309/2110354