On Sun, 30 May 2004 13:12:20 +1000
Dean Hamstead <[EMAIL PROTECTED]> wrote:

> has anyone got an intersting shell prompt or a link or something
> maybe a little more jazzy than... [EMAIL PROTECTED]:~$
> i know i just need edit ~/.bash_profile or /etc/profile
> im just not very creative today =)
I use this on my ibook, which gives me time, date, AC or DC and battery
level, [EMAIL PROTECTED] $PWD

09:26:38 dom mag 30 [AC Power: +98%] [EMAIL PROTECTED] ~
€ 

(I don't use $ for prompt, but the euro simbol, I'm in Europe ;))

-- 
()_() | Always keep the Titanic in mind when I talk about  | +----
(°.°) | security or safety, meaning that nothin is         | +---+
'm m' | fully secure.                                      |  O  |
(___) |                          raffaele presso salmaso punto org
GPG fingerprint 1CF5 51D4 E528 EB87 9977  B277 BE8C BF1E 620C 40ED
function pmu_battery() {
        BATTERY=`grep "AC Power" /proc/pmu/info | cut -d":" -f2 | cut -d" " -f2`
        if [ "$BATTERY" = "1"  ]; then
                echo "AC Power"
        else
                echo "Battery"
        fi
}

function pmu_percent() {
        CHARGE=`grep "charge     :" /proc/pmu/battery_0 | cut -d":" -f2 | cut 
-d" " -f2`
        MAX_CHARGE=`grep "max_charge :" /proc/pmu/battery_0 | cut -d":" -f2 | 
cut -d" " -f2`
        LEVEL=`echo $(( $CHARGE * 100 / $MAX_CHARGE ))`
        echo $LEVEL%
}

function pmu_color() {
        case $(pmu_percent) in
                10?%)  echo  "0;32"  ;;
                9?%)  echo  "0;32"  ;;
                8?%)  echo  "0;32"  ;;
                7?%)  echo  "0;32"  ;;
                6?%)  echo  "0;32"  ;;
                5?%)  echo  "0;32"  ;;
                4?%)  echo  "0;33"  ;;
                3?%)  echo  "0;33"  ;;
                2?%)  echo  "0;33"  ;;
                1?%)  echo  "0;31"  ;;         
                ?%)  echo  "0;31;5"  ;;
                *)  echo  "0;35"  ;;
        esac
}

export PS1='\033[36m\033[1m\]\t \d\[\033[34m 
\[\e[$(pmu_color)m\][$(pmu_battery): +$(pmu_percent)]\033[m [EMAIL PROTECTED] 
\[\033[1m\033[32m\]\w\[\033[1m\]\n\[\033[m\]� '

Reply via email to