Created
May 15, 2017 15:51
-
-
Save yudai09/7d5242c9d5f7d36c5d1f1caab9b7aeb7 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
# spinner characters | |
# http://stackoverflow.com/questions/2685435/cooler-ascii-spinners | |
# spinner code | |
# https://github.com/IntellexApps/blcheck.git | |
# Define spinner | |
#SPINNER="-\|/" | |
#SPINNER=".oO@*" | |
#SPINNER="▉▊▋▌▍▎▏▎▍▌▋▊▉" | |
#SPINNER="←↖↑↗→↘↓↙" | |
#SPINNER="▁▂▃▄▅▆▇█▇▆▅▄▃▁" | |
#SPINNER="▖▘▝▗" | |
#SPINNER="┤┘┴└├┌┬┐" | |
#SPINNER="◢◣◤◥" | |
#SPINNER="▤▥▦▧" | |
#SPINNER="⣾⣽⣻⢿⡿⣟⣯⣷" | |
#SPINNER="⠁⠂⠄⡀⢀⠠⠐⠈" | |
#SPINNER="◰◳◲◱" | |
#SPINNER="◴◷◶◵" | |
SPINNER="◐◓◑◒" | |
# Show progres | |
progress() { | |
# Bar | |
x=$(($1 % ${#SPINNER} + 1)) | |
BAR=$(echo $SPINNER | awk "{ print substr(\$0, ${x}, 1) }") | |
if test -z "$PLAIN"; then | |
printf "\r "; | |
fi | |
# BAR as printf arg so that backslash will be litteraly interpreted | |
printf "[ %s %3s%% ] checking... %4s / $2 " "$BAR" $(($1 * 100 / $2)) "$1"; | |
} | |
main() { | |
i=0; | |
max=100; | |
for i in $(seq $max); do | |
progress "$i" "$max" | |
sleep 0.1 | |
done | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment