From owner-freebsd-questions@FreeBSD.ORG Wed Aug 18 09:06:09 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 32B0616A4CE for ; Wed, 18 Aug 2004 09:06:09 +0000 (GMT) Received: from aiolos.otenet.gr (aiolos.otenet.gr [195.170.0.23]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7923443D80 for ; Wed, 18 Aug 2004 09:06:08 +0000 (GMT) (envelope-from keramida@linux.gr) Received: from orion.daedalusnetworks.priv (aris.bedc.ondsl.gr [62.103.39.226])i7I95jeT032100; Wed, 18 Aug 2004 12:05:51 +0300 Received: from orion.daedalusnetworks.priv (orion [127.0.0.1]) i7I95V3v005085; Wed, 18 Aug 2004 12:05:31 +0300 (EEST) (envelope-from keramida@linux.gr) Received: (from keramida@localhost)i7I95T7n005084; Wed, 18 Aug 2004 12:05:29 +0300 (EEST) (envelope-from keramida@linux.gr) Date: Wed, 18 Aug 2004 12:05:28 +0300 (EEST) From: Giorgos Keramidas To: Duane Winner In-Reply-To: <4122B61B.1050608@att.net> Message-ID: <20040818115550.T4343@orion> References: <41222679.7080000@att.net> <4122351E.7040205@att.net> <20040817165757.GA88222@thought.org> <4122B61B.1050608@att.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed cc: freebsd-questions@freebsd.org Subject: Re: xtset or xtermset tricks? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2004 09:06:09 -0000 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 %u@%h:`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: > root@mybox:~) 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