Last active
February 7, 2020 14:18
-
-
Save glacion/905f21368492c0d8dab2282315a96fb1 to your computer and use it in GitHub Desktop.
This file contains 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 | |
function print_spinner { | |
for item in "$@" | |
do | |
echo -n "$item" # Print without newline. | |
sleep 0.2 # Wait 0.2 seconds. | |
echo -ne "\b" # Erase previous character. | |
done | |
} | |
items=('|' '/' '-' '\') | |
while true # Infinite loop. | |
do | |
print_spinner "${items[@]}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment