Skip to content

Instantly share code, notes, and snippets.

@tripflex
Created October 22, 2014 23:28
Show Gist options
  • Save tripflex/e964bd36a6d95341859e to your computer and use it in GitHub Desktop.
Save tripflex/e964bd36a6d95341859e to your computer and use it in GitHub Desktop.
bash/shell progress function
process_progress() {
[ -z $1 ] && exit 0
PROGRESS=(". " " .. " " ... " " .. " " ." " .. " " ... " " .. ")
COUNTER=0
echo -n "$2 "
while `ps -p $1 > /dev/null`; do
[ $COUNTER -eq 8 ] && COUNTER=0
echo -n "${PROGRESS[$COUNTER]}"
echo -n " Running "
sleep 0.5
printf "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"
COUNTER=$(( $COUNTER + 1 ))
done
echo '...... Complete'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment