UNPKG

705 BMarkdownView Raw
1sleep
2===
3
4将目前动作延迟一段时间
5
6## 补充说明
7
8**sleep命令** 暂停指定的时间。
9
10### 语法
11
12```shell
13sleep(参数)
14```
15
16### 参数
17
18时间:指定要暂停时间的长度。
19
20时间长度,后面可接 s、m、h 或 d,其中 s 为秒,m 为 分钟,h 为小时,d 为日数。
21
22### 实例
23
24有时在写一些以循环方式运行的监控脚本,设置时间间隔是必不可少的,下面是一个Shell进度条的脚本演示在脚本中生成延时。
25
26```shell
27#!/bin/bash
28
29b=''
30for ((i=0;$i<=100;i++))
31 do
32 printf "Progress:[%-100s]%d%%\r" $b $i
33 sleep 0.1
34 b=#$b
35 done
36echo
37```
38
39
40<!-- Linux命令行搜索引擎:https://jaywcjlove.github.io/linux-command/ -->
\No newline at end of file