mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-08 23:14:06 +08:00
23 lines
938 B
HTML
23 lines
938 B
HTML
<h1 id="sleep">sleep</h1>
|
||
<p>将目前动作延迟一段时间</p>
|
||
<h2 id="补充说明">补充说明</h2>
|
||
<p><strong>sleep命令</strong> 暂停指定的时间。</p>
|
||
<h3 id="语法">语法</h3>
|
||
<pre><code class="language-bash">sleep(参数)</code></pre>
|
||
<h3 id="参数">参数</h3>
|
||
<p>时间:指定要暂停时间的长度。</p>
|
||
<p>时间长度,后面可接 s、m、h 或 d,其中 s 为秒,m 为 分钟,h 为小时,d 为日数。</p>
|
||
<h3 id="实例">实例</h3>
|
||
<p>有时在写一些以循环方式运行的监控脚本,设置时间间隔是必不可少的,下面是一个Shell进度条的脚本演示在脚本中生成延时。</p>
|
||
<pre><code class="language-bash">#!/bin/bash
|
||
|
||
b=''
|
||
for ((i=0;$i<=100;i++))
|
||
do
|
||
printf "Progress:[%-100s]%d%%\r" $b $i
|
||
sleep 0.1
|
||
b=#$b
|
||
done
|
||
echo</code></pre>
|
||
<!-- Linux命令行搜索引擎:https://jaywcjlove.github.io/linux-command/ -->
|