Created
July 27, 2015 15:30
-
-
Save sobanvuex/72e592d81b4bff78887c 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
progress () | |
{ | |
local pid="${1}" | |
local delay='0.1' | |
local indicator='┤┘┴└├┌┬┐' | |
# local indicator='▉▊▋▍▎▏▎▍▋▊▉' | |
# local indicator='▖▘▝▗' | |
local indicator='⣾⣽⣻⢿⡿⣟⣯⣷' | |
# local indicator='⠁⠂⠄⡀⢀⠠⠐⠈' | |
# local indicator='.oO@*' | |
# local indicator='▁▂▃▅▆▇▇▆▅▃▂▁' | |
while kill -0 "${pid}" 2> /dev/null | |
do | |
local progress="${indicator}" | |
while [ -n "${progress}" ] | |
do | |
echo -en "\r${2}: ${progress::1}\r" | |
sleep "${delay}" | |
progress=${progress:1} | |
done | |
done | |
echo -e "\r${2}: ✓" | |
wait ${pid} | |
return $? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment