Bash script: show progress bar

To show a bash script progress while loading:

function loading {
    while :; do
        case "$char" in
        sleep .2s
        echo -en "\rLoading $char"
loading &
# do something
sleep 5s
kill -9 $pid
wait $pid 2>/dev/null # Supress "Killed" message
echo -en "\r\033[K" # Completely overwrite last line
echo "Done."
Did this help you? Please let me know with a comment. Thank you
Posted .

Comments (RSS)

Leave a comment