Created
October 22, 2014 23:28
-
-
Save tripflex/e964bd36a6d95341859e to your computer and use it in GitHub Desktop.
bash/shell progress function
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
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