Created
April 14, 2015 11:56
-
-
Save cyrbil/0be26032566ea2179f27 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 () { | |
local pid=$1 | |
local speed=${2:-.1} | |
local text=$3 | |
local spin="⢎⡰⢎⡡⢎⡑⢎⠱⠎⡱⢊⡱⢌⡱⢆⡱" | |
local i=0 | |
while kill -0 "$pid" 2>/dev/null | |
do | |
local i=$(( (i+1) % 8)) | |
local c1=$(echo $spin | cut -c$(( i*6+1 ))-$(( i*6+3 ))) | |
local c2=$(echo $spin | cut -c$(( i*6+4 ))-$(( i*6+6 ))) | |
printf "\r$3$c1$c2" | |
sleep "$speed" | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment