[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

bash prompt won't wrap properly



Hi,

I've modified my bash prompt to display the number of minutes of
battery time left. I use the following code in my .bashrc:

##########

alias bt="acpi | awk '{print \$5}' | awk -F : '{print \$1*60 + \$2}'"

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm)
    PS1='\033[01;31m\]$(bt)\033[00m\]|\033[01;32m\]\u\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]-> '
    ;;
*)
    PS1='\u:\W-> '
    ;;
esac

###########

This works as expected, except that now if I enter a line that is
longer than the screen width, instead of continuing on the *next* line
it continues on the *same* line, over-writing  what is there. I can
still pass the line to bash, which interprets it correctly, but it is
confusing and pretty much impossible to edit. What did I do wrong?

Tyle



Reply to: