On 10/20/05, Tor Olav Stava <[EMAIL PROTECTED]> wrote:
> I'll give it a try :) But still, I guess this won't work in a non-login
> shell? It would be a nice feature when I'm using package users when
> building packages. It's happened more than once that I screw something
> up, cause I wrote some commands in the wrong Xterm.. :( like overwriting
> some Libc files with uClibc. hehe.. ups.. backup is very nice.. :D

This isn't the problem that this is a non-login shell.  The problem is
that you're su-ing to another user.  Your xterm is a non-login shell,
and it works fine.

OK, what we've been talking about if PROMPT_COMMAND, but you can do
everything you want in PS1.  unset PROMPT_COMMAND again.  Say you've
got:
PS1='[EMAIL PROTECTED]:\w\$ '

Change this to:
PS1='\[\033]0;[EMAIL PROTECTED] : [EMAIL PROTECTED]:\w\$ '
If I remember right, \033 and \077 are xterm escape sequences.  But
I'm speculating.  I just copy this from one host to the next.

This uses all bash escape sequences \u, \h, and \w instead of
environment variables ${USER}, ${HOSTNAME} and ${PWD}.

And now for the money shot, you might want to put this in
extra-prompt.sh or somewhere else it will be sourced:
case $TERM in
        xterm*)
                PS1='\[\033]0;[EMAIL PROTECTED] : [EMAIL PROTECTED]:\w\$ '
        *)
                PS1='[EMAIL PROTECTED]:\w\$ '
esac
export PS1

This worked with su when I tried it.

--
Dan
--
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to