Skip to content

Instantly share code, notes, and snippets.

@di3
Created May 16, 2019 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save di3/34ad061e7c47292e514102f576ad2b2e to your computer and use it in GitHub Desktop.
Save di3/34ad061e7c47292e514102f576ad2b2e to your computer and use it in GitHub Desktop.
#!/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