Return to Snippet

Revision: 30795
at August 28, 2010 02:30 by ksaver


Updated Code
#!/usr/bin/env bash
# simplepb.sh
# A very simple bash progress bar.
# Still needs a lot of work to become useful.
# ksaver (at identi.ca), Aug 2010.
# License: Public Domain

function progr_bar()
{
    MAX=$1
    PERCENT=0
    FOO=">"
    BAR=""

    while [ $PERCENT -lt $(($MAX+1)) ]
    do  
        echo -ne "\r\t[ "
        echo -ne "$BAR$FOO ] $((PERCENT*100/$MAX))% "
        BAR="${BAR}="
        let PERCENT=$PERCENT+1
        sleep 0.2
    done

    echo -e " Done.\n"
}

progr_bar 20

Revision: 30794
at August 22, 2010 16:12 by ksaver


Initial Code
#!/usr/bin/env bash
# A very simple bash progress bar.
# Still needs a lot of work to become useful.
# ksaver (at identi.ca), Aug 2010.
# License: Public Domain

function progr_bar()
{
    MAX=$1
    PERCENT=0
    FOO=">"
    BAR=""

    while [ $PERCENT -lt $(($MAX+1)) ]
    do  
        echo -ne "\r\t[ "
        echo -ne "$BAR$FOO ] $((PERCENT*100/$MAX))% "
        BAR="${BAR}="
        let PERCENT=$PERCENT+1
        sleep 0.2
    done

    echo -e " Done.\n"
}

progr_bar 20

Initial URL
http://identi.ca/ksaver

Initial Description

                                

Initial Title
A very simple bash progress bar.

Initial Tags
Bash

Initial Language
Bash