You are not logged in.

#1 2006-01-21 15:40:37

jerem
Member
From: France
Registered: 2005-01-15
Posts: 310

Bash prompt vs Zsh prompt problem [SOLVED]

I have set up my .zshrc and it works perfectly

function bat1()
{
    echo $(( $(awk ' /remaining/ {print $3} ' /proc/acpi/battery/BAT0/state) * 100 / 71590 ))
}
# 71590 is the capacity of my #1 bat in mWh


function bat2()
{
    echo $(( $(awk ' /remaining/ {print $3} ' /proc/acpi/battery/BAT1/state) * 100 / 46620 ))
}
# 46620 is the capacity of my #2 bat in mWh


#Right-side zsh promp :
RPROMPT=' $PR_RED$(bat1)/$(bat2)$PR_NO_COLOR'

Each time I get a new prompt(when a command finishes or I simply type <Return>) the battery info is updated.


Now let's consider bash :

Same functions, same way of working :

PS1="$(bat1)/$(bat2) >"

The problem is that bash does not automatically update the battery info. I need to source my .bashrc, which is, of course, a real pain.

Can any bash guru help me to find a solution to make bash work like zsh ?

Offline

#2 2006-01-21 16:23:58

Cerebral
Forum Fellow
From: Waterloo, ON, CA
Registered: 2005-04-08
Posts: 3,108
Website

Re: Bash prompt vs Zsh prompt problem [SOLVED]

Try

PS1="$(bat1)/$(bat2) >"

Offline

#3 2006-01-21 17:06:29

jerem
Member
From: France
Registered: 2005-01-15
Posts: 310

Re: Bash prompt vs Zsh prompt problem [SOLVED]

Your trick works perfectly, thanks !

Offline

Board footer

Powered by FluxBB