生成进度条的俩个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%ce[0m] " "$bar" "$i" "${arr[$index]}" let i++ let index++ usleep 30000 bar+='#' done printf " "
执行效果
!/bin/bash b='' for ((i=0;$i<=100;i+=2)) do printf "progress:[%-50s]%d%% " $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