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

PS1 corrupted through "su"



I have been dabbling with zsh, and I put some color in my prompt.  This is
the relevant init stuff:

red="$(echo -n '%{%}')"
cyan="$(echo -n '%{%}')"
yellow="$(echo -n '%{%}')"
normal="$(echo -n '%{%}')"
export PS1="%(?.${yellow}.${red})%~%(!.${red}#.${cyan}%%)${normal} "

This works great, until I su root.  As my normal user, I get color and
everything looks like it should.  It looks like
/usr/local% 
^yellow   ^cyan

When I su, the prompt turns to 
%(?.%{%}.%{%})%~%(!.%{%}#.%{%}%%)%{%}
      ^yel ^red             ^cyan  ^ normal

where I have marked the spots where the gibberish changes colors.  It
appears that the color change commands are interpreted at the wrong time.
If I type "echo $PS1", I get the same thing.  If I then start a new shell
as root (by typing "zsh"), things work as expected.

Why doesn't PS1 make it through the su?  How do I get it to work, without
having to start up a new shell?

Thanks,
	John



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