当前位置: 操作系统/服务器>linux
shell 进度条实现代码
来源: 互联网 发布时间:2014-10-13
本文导语: 代码如下:#!/bin/bashCOUNTER=0_R=0_C=`tput cols`_PROCEC=`tput cols`tput cup $_C $_Rprintf "["while [ $COUNTER -lt 100 ]do COUNTER=`expr $COUNTER + 1` sleep 0.1 printf "=>" _R=`expr $_R + 1` _C=`expr $_C + 1` tput cup $_PROCEC 101 printf "]%d%%" $COUNTE...
代码如下:
#!/bin/bash
COUNTER=0
_R=0
_C=`tput cols`
_PROCEC=`tput cols`
tput cup $_C $_R
printf "["
while [ $COUNTER -lt 100 ]
do
COUNTER=`expr $COUNTER + 1`
sleep 0.1
printf "=>"
_R=`expr $_R + 1`
_C=`expr $_C + 1`
tput cup $_PROCEC 101
printf "]%d%%" $COUNTER
tput cup $_C $_R
done
printf "n"