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
有时在写一些以循环方式运行的监控脚本, 设置时间间隔是必不可少的
来源: http://www.bubuko.com/infodetail-2583726.html