Last active
August 29, 2015 14:11
-
-
Save petitviolet/41822ba48b242fd99664 to your computer and use it in GitHub Desktop.
loading indicator like `npm install`
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
#!/usr/bin/env zsh | |
loading() { | |
local count=30 | |
if [ $# -eq 1 ]; then | |
count=$1 | |
fi | |
for i in `seq 1 1 $count` | |
do | |
echo -en '|\b' 1>&2; sleep 0.05; | |
echo -en '/\b' 1>&2; sleep 0.05; | |
echo -en '-\b' 1>&2; sleep 0.05; | |
echo -en '\\\b' 1>&2; sleep 0.05; | |
done | |
echo -en ' \b' 1>&2; | |
exit 0 | |
} | |
loading $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment