用shell实现一个进度条

#!/bin/bash
i=0
str='#'
ch=('|' '\' '-' '/')
index=0
while [ $i -le 25 ]
do
	printf "[%-25s][%d%%][%c]\r" $str $(($i*4)) ${ch[$index]}
	str+='#'
	let i++
	let index=i%4
	sleep 0.1
done
printf "\n"

 

posted @ 2017-07-14 11:44  Linux专题站  阅读(1695)  评论(0编辑  收藏  举报