Skip to content

Instantly share code, notes, and snippets.

@juris
Created September 13, 2017 15:11
Show Gist options
  • Save juris/49b73ecc6973238d509639f044c075d3 to your computer and use it in GitHub Desktop.
Save juris/49b73ecc6973238d509639f044c075d3 to your computer and use it in GitHub Desktop.
bash spinner function
# 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