1.实现效果
2.shell脚本
#!/bin/bash
i=0
bar=''
index=0
arr=( "|" "/" "-" "\\" )
echo "数据分发中......"
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++
sleep $(($RANDOM%3))
#sleep 0.1
bar+='='
done
printf "\n"
printf "数据分发完成.\n"
来源:CSDN
作者:罗汉爷
链接:https://blog.csdn.net/IndexMan/article/details/104110387