Skip to content

Instantly share code, notes, and snippets.

@jonas
Created October 24, 2012 15:31
Show Gist options
  • Save jonas/3946762 to your computer and use it in GitHub Desktop.
Save jonas/3946762 to your computer and use it in GitHub Desktop.
Show progress spinner based on chatty commands
# Usage:
# progresstinate "Building $SERVER_WAR" \
# mvn clean install
progresstinate() {
msg="$1"; shift; args="$@"; symbol="-"
printf "$msg [$symbol]"
"$@" | while read line; do
symbol="$(echo "$symbol" | tr -- '-/|\\' '/|\\-')"
printf "\b\b$symbol]"
done
printf "\b\bDONE]\n"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment