Linda Walsh wrote:
> But anyway, something else is is awry.
> 
> Now my root prompt, instead of being red, looks like:
> 
> "\[\033[1m\]\[\033[31m\]Ishtar:root#\[\033[0m\] "
> 
> ;-/

That will be due to incorrect quoting.  Which suggestion did you
implement?  There were several.

> What version of bash has the \[ \] characters to keep it from
> counting chars?

All of them.

Try this *exactly* as I post it.  I did test this.  It probably isn't
optimal.  But it does what you are asking.  And it is only a slight
variation from what you are currently using.

   _CRed=$(tput setaf 1)  #Red
   _CRST=$(tput sgr0)   #Reset
   _CBLD=$(tput bold)   #Bold
   _prompt_open=""
   _prompt_close=""
   _prompt=">"
   [[ $UID -eq 0 ]] && {
       _prompt_open="$_CBLD$_CRed"
       _prompt_close="$_CRST"
       _prompt="#"
   }
   PS1='\[$_prompt_open\]$(pwd "$PWD")$_prompt\[$_prompt_close\] ';

Bob

Reply via email to