Created
September 13, 2017 15:11
-
-
Save juris/49b73ecc6973238d509639f044c075d3 to your computer and use it in GitHub Desktop.
bash spinner function
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
# Simple spinner function to show rotating stick | |
# while process is doing something useful | |
spinner() { | |
local pid=$! | |
local spin='-\|/' | |
while kill -0 $pid 2>/dev/null | |
do | |
i=$(( (i+1) %4 )) | |
printf "\r${spin:$i:1}" | |
sleep .2 | |
done | |
printf "\r" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment