ANSI/VT100 Terminal Control Escape Sequences
http://www.termsys.demon.co.uk/vtansi.htm#scroll
#!/bin/bash
process_bar()
{
STR=0
START=8;
RES_COL=110
while [ $STR -lt 101 ]
do
echo -ne "\033[G $((STR*1*100/100))%"
if [ $START -ge 10 ]; then echo -ne " [ "; fi
echo -ne "\\033[$(($START+1))G="
if [ $STR -eq 100 ]; then
echo -ne "\033[1c=";
else
echo -ne "\033[1c>";
fi
((STR++))
((START++))
sleep 0.1
done
}
process_bar;
echo -ne " ]\n"
明天继续修正
process_bar()
{
TOTAL=$1
STR=0
TEMP=1;
RES_COL=105
echo ""
echo "SYSTEM INSTALLING ..."
echo ""
echo -ne "\\033[0G[";
echo -ne "\\033[102G]"
while [ $TEMP -lt 100 ]
do
((STR++))
TEMP=$(($STR*100/$TOTAL));
if [ $TEMP -eq 0 ]; then TEMP=1; fi;
echo $TEMP >>/tmp/aaa.txt
echo -ne "\\033[${RES_COL}G $((TEMP*1*100/100))% "
echo -ne "\\033[$((TEMP+1))G#"
if [ $TEMP -lt 100 ]; then echo -ne "\033[1c>"; fi
sleep 0.1
done
echo -ne "\n";
}
process_bar 200;