On 2004-08-17 21:51, Duane Winner wrote:
Gary Kline wrote:
On Tue, Aug 17, 2004 at 12:41:02PM -0400, Duane Winner wrote:
Found a solution!

In ~/.bashrc, put this:

cd ()
{
  builtin cd "$@"
  /usr/local/bin/xtset [EMAIL PROTECTED]:`pwd`
}

        I've got a slight problem with having the host/directory/etc on the
        title bar. It will help clear my zsh right-prompt, of course.

But now, since I hammered out that little cd() function for .bashrc, I
found another little problem:

If I su to another user (for instance, "su - root"), the title changes
as long as the other account has my the function in .bashrc, but when
I exit, the title still has the old credentials (example:
[EMAIL PROTECTED]:~) until I cd somewhere again. Sigh.

Don't use cd aliases for showing the current path in your xterm titlebar. There's a more elegant way involving PROMPT_COMMAND:

    bash-2.05b$ export PS1='\$ '
    $ export PROMPT_COMMAND='echo ::`pwd`::'
    ::/home/keramida::
    $ cd /etc
    ::/etc::
    $ cd /usr/src
    ::/usr/src::
    $ exit
    exit

You can set PROMPT_COMMAND to any command you want, no matter how
complicated.  A nice wrapper script around your "usual stuff" for
PROMPT_COMMAND can be called too with:

    $ export PROMPT_COMMAND='/home/keramida/bin/promptcmd.sh'

Regarding the current username, host name and directory, you might be
interested in this output too:

    $ echo $USER
    keramida
    $ hostname -s
    orion
    $ echo $PWD
    /home/keramida
    $

- Giorgos

_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to