shell的进度条【转】

生成进度条的俩个shell脚本

!/bin/bash 
i=0 
bar='' 
index=0 
arr=( "|" "/" "-" "\\" ) 
while [ $i -le 100 ] 
do 
        let index=index%4 
        printf "[%-100s][%d%%][\e[43;46;1m%c\e[0m]\r" "$bar" "$i" "${arr[$index]}" 
        let i++ 
        let index++ 
        usleep 30000 
        bar+='#' 
done 
printf "\n"

 执行效果

 

!/bin/bash 
b=''
for ((i=0;$i<=100;i+=2))
do
        printf "progress:[%-50s]%d%%\r" $b $i  #生成50个#
        sleep 0.1
        b=#$b
done
echo

执行效果

 

 转自

Shell 显示一个进度条-iceway-ChinaUnix博客 http://blog.chinaunix.net/uid-9188830-id-2007059.html

(3条消息)shell实现一个简单进度条 - 博客 - CSDN博客 https://blog.csdn.net/xs_520/article/details/73917884

 

posted @ 2019-03-21 14:24  paul_hch  阅读(454)  评论(0编辑  收藏  举报