Skip to content

Instantly share code, notes, and snippets.

@petitviolet
Last active August 29, 2015 14:11
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 petitviolet/41822ba48b242fd99664 to your computer and use it in GitHub Desktop.
Save petitviolet/41822ba48b242fd99664 to your computer and use it in GitHub Desktop.
loading indicator like `npm install`
#!/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