chinaunix上发现的,很有意思.收录下来
[@more@]
drawper ()
{
_per=`expr $1 * 100 / $2`
case `expr $_per / 4 % 4` in
0) _char="|" ;;
1) _char="/" ;;
2) _char="-" ;;
3) _char="" ;;
esac
printf "r$_char $_per%%"
if [ $1 -eq $2 ];then
printf "n"
fi
}
i=1
while [ $i -le 100 ]
do
drawper $i 100
i=`expr $i + 1`
done
{
_per=`expr $1 * 100 / $2`
case `expr $_per / 4 % 4` in
0) _char="|" ;;
1) _char="/" ;;
2) _char="-" ;;
3) _char="" ;;
esac
printf "r$_char $_per%%"
if [ $1 -eq $2 ];then
printf "n"
fi
}
i=1
while [ $i -le 100 ]
do
drawper $i 100
i=`expr $i + 1`
done
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/640706/viewspace-1043912/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/640706/viewspace-1043912/