代码:
#!/bin/bashfunction dongtai(){
i=0
bar=''
index=0
arr=( "|" "/" "-" "\\" )while [ $i -le 100 ]
dolet index=index%4printf "[+]准备开始:[%-100s][%d%%][\e[43;46;1m%c\e[0m]\r" "$bar" "$i" "${arr[$index]}"let i++let index++usleep 30000bar+='#'clear
done
}dongtai
echo -e "[+]准备完成"
运行结果: