shell命令行进度条实现
#!/bin/bash
i=0
while [[ $i -lt 100 ]]; do
let "i++"
printf "\r%-3d%%" $i
for (( j = 0; j < $i; j++ )); do
let "k = j%2"
if [[ $k -eq 0 ]]; then
printf "▉"
fi
done
sleep 0.5
done
printf "\r\n"
发表回复