zsh-users
 help / color / mirror / code / Atom feed
* PS1 corrupted through "su"
@ 2000-01-03 17:25 John Galbraith
  2000-01-03 18:03 ` Christoph Berg
  2000-01-03 18:10 ` Steve Reid
  0 siblings, 2 replies; 6+ messages in thread
From: John Galbraith @ 2000-01-03 17:25 UTC (permalink / raw)
  To: zsh-users

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

red="$(echo -n '%{^[[31m%}')"
cyan="$(echo -n '%{^[[36m%}')"
yellow="$(echo -n '%{^[[33m%}')"
normal="$(echo -n '%{^[[0m%}')"
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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2000-01-04  0:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-03 17:25 PS1 corrupted through "su" John Galbraith
2000-01-03 18:03 ` Christoph Berg
2000-01-03 18:10 ` Steve Reid
2000-01-03 18:14   ` John Galbraith
2000-01-03 18:23     ` Nemeth Ervin
2000-01-04  0:18     ` John Galbraith

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).