Skip to content

Instantly share code, notes, and snippets.

@etaf
Created December 26, 2016 13:33
Show Gist options
  • Save etaf/9edd273c0a7ae918896e8fc07a3df65f to your computer and use it in GitHub Desktop.
Save etaf/9edd273c0a7ae918896e8fc07a3df65f to your computer and use it in GitHub Desktop.
spinner() {
local spin="\\|/-"
local i=0
tput civis
while kill -0 "$1" 2>/dev/null; do
i=$(( (i+1) %4 ))
printf "\b%s" "${spin:$i:1}"
sleep 0.07
done
tput cnorm
}
cmd ...
spinner $!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment