Last active
July 20, 2017 14:54
-
-
Save shammellee/4a79fbe882a56d047e59fdd36986438d 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
#! /usr/bin/env bash | |
function times() | |
{ | |
_in_string="$1" | |
_out_string="" | |
_count=$2 | |
for (( i=0; i < $_count; i++ )) | |
do | |
_out_string+="$_in_string" | |
done | |
echo "$_out_string" | |
} | |
_hundred_spaces="$(times " " 100)" | |
for i in {0..100} | |
do | |
if [[ $i -lt 100 ]] | |
then | |
color=33 | |
eol="\r" | |
else | |
color=32 | |
eol="\n" | |
fi | |
printf "\e[${color}m%s%.*s\e[m [%3d%%]${eol}" "$(times "█" $i)" $((100 - i)) "$_hundred_spaces" $i | |
sleep .05 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment