Dan Nicholson wrote:
On 10/20/05, Tor Olav Stava <[EMAIL PROTECTED]> wrote:
if [ "${TERM:0:5}" = "xterm" ]; then
export PROMPT_COMMAND='echo -ne "\033]0;[EMAIL PROTECTED] : ${PWD}\007"'
fi
I've been using this for a long time and it works as expected.
Is it possible to get this working in a non-login shell?
I've tested it in Xterm, and nothing happens until I do an su -
Looks very promising though, as I just deleted the old script as it
screwed up my promp before. This is a lot better. ;)
Well, this is where you have to get creative. By definition, an su
will not change $USER. So, you have to find a more clever way of
getting the username into the echo statement. Here's a cheap hack:
If you have it set up that the home directory of each user is it's
name (for the users you plan on su-ing to anyway), then you can use
the end of the $HOME variable as the user name. i.e.,
PROMPT_COMMAND='echo -ne "\033]0;${HOME##*/[EMAIL PROTECTED] : ${PWD}\007"'
That will strip off all the longest match from the beginning of $HOME to /.
Really, though, this is a crappy solution. Unless you spend a long
time in su, I don't see why this is a big problem. And if it is a big
problem for you, maybe you should just remove ${USER} from
PROMPT_COMMAND. It was just an example anyway.
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
Anyway, maybe there's a better way to tinker the xterm? I was thinking
about Xresources, but that's for another time.. Wanna finish building my
system now. :)
Thanks again,
Tor Olav
--
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page