程序实现:
1 #!/bin/bash
2
3 i=0
4 bar=''
5 lable=( '|' '/' '-' '\\' )
6 index=0
7 while [ $i -le 100 ]
8 do
9 printf " [%-100s][%d%%][%c]\r" "$bar" "$i" "${lable[$index]}"
10 bar='#'$bar
11 let i++
12 let index++
13 let index%=4
14 usleep 30000
15 done
16
17 printf "\n"
运行结果: