On Thu, 2005-10-20 at 12:43 -0700, Dan Nicholson wrote:
> 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 /.

Simplest option is to replace the reference to $USER with `whoami` (note
the backticks). That will always return the correct user, although it
means launching an additional process each time.

Simon.

Attachment: signature.asc
Description: This is a digitally signed message part

-- 
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