Created
May 16, 2019 21:08
-
-
Save di3/34ad061e7c47292e514102f576ad2b2e to your computer and use it in GitHub Desktop.
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
#!/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