how to generate progress in shell?

#!/bin/sh

b=''

for ((i=0;$i<=100;i+=2))
do
    printf "progress:[%-50s]%d%%\r" $b $i
    sleep 0.1
    
    b=.$b
done
echo

运行结果为:
progress:[..................]100%

利用-\|/实现旋转滚动效果
#!/bin/bash
i=0
while [ $i -lt 20 ]
do
for j in '-' '\' '|' '/'
do
printf "intel testing : %s\r" $j
sleep 0.1
((i++))
done
done

相关推荐