zsh-users
 help / color / mirror / code / Atom feed
From: John Galbraith <john@bartok.lanl.gov>
To: zsh-users@sunsite.auc.dk
Subject: PS1 corrupted through "su"
Date: Mon,  3 Jan 2000 10:25:56 -0700 (MST)	[thread overview]
Message-ID: <14448.55754.322294.62194@bartok.lanl.gov> (raw)

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


             reply	other threads:[~2000-01-03 17:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-03 17:25 John Galbraith [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14448.55754.322294.62194@bartok.lanl.gov \
    --to=john@bartok.lanl.gov \
    --cc=zsh-users@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).