【SHELL】百分比进度指示,原地踏步
百分比进度指示,原地踏步效果实现主要利用退格'\b',同行'\c'
#!/bin/bash
function percentage_progress()
{
progress=$(($1*100/$2))
if [ $progress -lt 10 ];then
echo -e "${progress}%\b\b\c"
elif [ $progress -lt 100 ];then
echo -e "${progress}%\b\b\b\c"
else
echo -e "${progress}%\c"
fi
}
target=5672
start=0
while test $start -le $target
do
percentage_progress $start $target
((start++))
sleep 0.001
done
再牛逼的梦想也架不住傻逼似的坚持