Last active
December 31, 2015 11:59
-
-
Save geta6/7983537 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MAX=`echo "\`tput cols\` - 20" | bc` | |
PROGRESS() { | |
PRG=`echo "$1 * 100 / $2" | bc` | |
CUR=`echo "$MAX * $PRG / 100" | bc -l | cut -d'.' -f1` | |
STR='[' | |
for i in `seq 1 $MAX`; do | |
if [[ $i -le $CUR ]]; then STR="$STR="; else STR="$STR "; fi | |
done | |
echo "$STR] $PRG%\r\c" >&2 | |
} | |
echo | |
for i in {1..200}; do | |
PROGRESS $i 200 | |
done | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment