Skip to content

Instantly share code, notes, and snippets.

@glacion
Last active February 7, 2020 14:18
Show Gist options
  • Save glacion/905f21368492c0d8dab2282315a96fb1 to your computer and use it in GitHub Desktop.
Save glacion/905f21368492c0d8dab2282315a96fb1 to your computer and use it in GitHub Desktop.
#!/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