Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Colored PS1


 from the german version of the zsh-lovers page I got the following
 hint to colorise the prompt of the shell:

     autoload -U colors && colors
     echo "$fg_bold[red]zsh $fg_no_bold[white]is $bg[blue]$fg_bold[green]nice"

 which prints a colored string. So far so nice.

 Now I thought my previous PS1-string

     export PS1="%B%(?..[%?] )%b%n@%U%m%u:%1~>"

 would be nicer if I would change it to:

     export PS1="%B%(?..[%?] )$fg_bold[red]%b$fg_no_bold[black]%n@%U%m%u:%1~>"

 but this does not work for me. The prompt remains the same but
 expansion/expanding on the commandline gets a hickup. My TERM is set
 to "xterm" and normally colored output is no problem.

 What is wrong in my assumption, that first the $fg_bold[red] and
 $fg_no_bold[black] get expanded to their "real" escape sequences and
 then and thing like %b get replaced by their current value and then
 the string is sent to the terminal which finally colors the output

 If I do a 

     echo $PS1"

 I get a correctly colored output (the special expanding of for
 example %b is missing then, which is ok).


 Thank you very much for any help in advance !

 Have a nice week!

Messages sorted by: Reverse Date, Date, Thread, Author