Skip to content

Instantly share code, notes, and snippets.

@juris

juris/spinner.sh

Created Sep 13, 2017
Embed
What would you like to do?
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