Yes, it seems not possible to turn the color around in the middle of a screen line...
Code:
ps1='#' # better use a case or if/else here: root -> # otherwise -> $
REDONYELLOW="^[[0;31;43m" # insert ESC char with ctrl-V ESC
WHITEONBLACK="^[[0;37;40m" # same here
PS1=${REDONYELLOW}$(hostname):'[$PWD]${WHITEONBLACK}
${ps1} '
the numbers for atrributes/foreground color/background color can be found on the web (Google's lucky shot):
I also tried "tput setf 1" and "tput setb 3" to make this more portable but that does not seem to work for xterm/putty - I guess the xterm terminfo is incomplete?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.