You are not logged in.
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
Try
PS1="$(bat1)/$(bat2) >"
Offline
Your trick works perfectly, thanks !
Offline