进度条在以后开发,测试,运维中,可实现自动化检查项目的更新、运行等情况,大大加快工作效率。
1.代码实现
1 #!/bin/bash
2 function proc()
3 {
4 count=0
5 bar=""
6 lable=("|" "/" "-" "\\")
7 while [ $count -le 100 ]
8 do
9 let index=count%4
10 printf "[\033[1m\033[1;34m%-101s\033[0m] [%d%%] [%c]\r" "$bar" "$count" "${lable[$index]}"
11 bar=${bar}‘=‘
12 ((count++))
13 sleep 0.05
14 done
15 printf "\n"
16 }
17 proc2.输出结果:
本文出自 “sunshine225” 博客,请务必保留此出处http://10707460.blog.51cto.com/10697460/1790053
原文:http://10707460.blog.51cto.com/10697460/1790053