* 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
* Re: PS1 corrupted through "su"
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
1 sibling, 0 replies; 6+ messages in thread
From: Christoph Berg @ 2000-01-03 18:03 UTC (permalink / raw)
To: zsh-users
Hello,
I have another question concering the prompt stuff:
My $prompt looks like this:
prompt="%{^[]0;%n@%m:%/^G%}
[%B%{^[[31m%}%?%{^[[0m%}%b] %U%n@%m%u:%40<..<%B%{^[[34m%}%/%{^[[0m%}%b %#"
The main point is that it puts something like "cb@df7cb:/home/cb" in
xterm's title bar.
I would like to have the name of the command currently executed included
there and $POSTEDIT seems the right place to put the escape sequences
needed; however $POSTEDIT does not evaulate variable, so I only get
"%n@%m:%/" as title.
How can I tell zsh to evaluate %- and $-expressions and which variable
contains the command being executed?
... Christoph
PS: It would be nice to have quoting for ESC (^[), ^J etc. (e.g. \012)
--
Christoph Berg <cb@heim-d.uni-sb.de>
Wohnheim D, Zi. 2405, Universität des Saarlandes
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: PS1 corrupted through "su"
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
1 sibling, 1 reply; 6+ messages in thread
From: Steve Reid @ 2000-01-03 18:10 UTC (permalink / raw)
To: John Galbraith; +Cc: zsh-users
On Mon, Jan 03, 2000 at 10:25:56AM -0700, John Galbraith wrote:
> export PS1="%(?.${yellow}.${red})%~%(!.${red}#.${cyan}%%)${normal} "
> This works great, until I su root.
[snip]
> If I then start a new shell as root (by typing "zsh"), things work as
> expected.
Root's shell being set to something other than zsh would cause the
behavior you're seeing.
You've probably checked that already, but sometimes the obvious things
are the easiest to forget.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: PS1 corrupted through "su"
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
0 siblings, 2 replies; 6+ messages in thread
From: John Galbraith @ 2000-01-03 18:14 UTC (permalink / raw)
To: Steve Reid; +Cc: John Galbraith, zsh-users
>>>>> "Steve" == Steve Reid <sreid@sea-to-sky.net> writes:
Steve> Root's shell being set to something other than zsh would cause
Steve> the behavior you're seeing.
Steve> You've probably checked that already, but sometimes the obvious
Steve> things are the easiest to forget.
Yeah, I have a special user "toor" that is root, but uses
/usr/local/bin/zsh as the shell. I only actually use "root" itself if
/usr/local is either missing or not installed yet. I once made the mistake
of setting the actual root shell to /usr/local/bin/zsh...
John
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: PS1 corrupted through "su"
2000-01-03 18:14 ` John Galbraith
@ 2000-01-03 18:23 ` Nemeth Ervin
2000-01-04 0:18 ` John Galbraith
1 sibling, 0 replies; 6+ messages in thread
From: Nemeth Ervin @ 2000-01-03 18:23 UTC (permalink / raw)
To: John Galbraith; +Cc: Steve Reid, zsh-users
>>>>> John Galbraith writes:
>>>>> "Steve" == Steve Reid <sreid@sea-to-sky.net> writes:
Steve> Root's shell being set to something other than zsh would cause
Steve> the behavior you're seeing.
Steve> You've probably checked that already, but sometimes the obvious
Steve> things are the easiest to forget.
> Yeah, I have a special user "toor" that is root, but uses
> /usr/local/bin/zsh as the shell. I only actually use "root" itself if
> /usr/local is either missing or not installed yet. I once made the mistake
> of setting the actual root shell to /usr/local/bin/zsh...
I have a "suz" function wich sets te SHELL parameter to zsh and does an exec
zsh after suing.
--
____ ____________________________________________________
/____| NEMETH, ERVIN |____________________________________________________|
// < airwin @ inf.bme.hu > http://www.inf.bme.hu/~airwin
||
|| "Nonsense. All you have to do is say 'Engage'"
|| -- Patrick Stewart about warp theory
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: PS1 corrupted through "su"
2000-01-03 18:14 ` John Galbraith
2000-01-03 18:23 ` Nemeth Ervin
@ 2000-01-04 0:18 ` John Galbraith
1 sibling, 0 replies; 6+ messages in thread
From: John Galbraith @ 2000-01-04 0:18 UTC (permalink / raw)
To: zsh-users
I seem to have answered my own question. I had some strange file in my
home directory called .zsomething-or-other that I can't even remember what
it was called. In it, it had 'PS1='. I blew it away, and my problem went
with it. I don't know how that file got there or how long it was there. I
can do my su now, though.
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).