Skip to content

Instantly share code, notes, and snippets.

@akavel
Created July 9, 2013 10:23
Show Gist options
  • Save akavel/5956303 to your computer and use it in GitHub Desktop.
Save akavel/5956303 to your computer and use it in GitHub Desktop.
function throbber()
{
local rs="${1-\n}"
gawk '
BEGIN {RS="'"$rs"'"; ORS=RS; s="/-\\|"}
{print $0}
NR%100==0 {printf(substr(s,(NR/100)%4+1,1)"\b") > "/dev/stderr"}
NR%1000==0 {printf(".") > "/dev/stderr"}
END{print "" > "/dev/stderr"}
'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment