Skip to content

Instantly share code, notes, and snippets.

@di3
Created May 16, 2019
Embed
What would you like to do?
#!/bin/bash
spinner() {
local i sp n
sp='/-\|'
n=${#sp}
printf ' '
while sleep 0.1; do
printf "%s\b" "${sp:i++%n:1}"
done
}
main() {
spinner &
spinner_pid=$!
# do something here
kill $spinner_pid
wait $spinner_pid 2>/dev/null
# done
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment