Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!dali.cs.montana.edu!rpi!crdgw1!montnaro From: montnaro@spyder.crd.ge.com (Skip Montanaro) Newsgroups: comp.unix.questions Subject: Re: Pathname in prompt, not FAQ, really. Message-ID: Date: 12 Jun 90 19:54:45 GMT References: Sender: news@crdgw1.crd.ge.com Reply-To: montanaro@crdgw1.ge.com (Skip Montanaro) Organization: GE Corporate Research & Development, Schenectady, NY Lines: 20 In-reply-to: avalon@tardis.computer-science.edinburgh.ac.uk's message of 12 Jun 90 10:29:33 GMT I alias cd to the following ksh function to put the current directory in the title bar of my xterms. It does the ~ substitution as requested. Note that there are two ASCII ESC chars ("^[") and two ASCII BEL chars ("^G") in the code below. Substitute (Saturate? :) before using, folks. hostname=$(hostname) function cdxterm { \cd "$@" dir="${PWD#$HOME/}" if [ $dir != $PWD ] ; then dir="~/$dir" elif [ $dir = $HOME ] ; then dir="~" fi print -n "^[]1;$hostname^G^[]2;$hostname : $dir^G" } -- Skip (montanaro@crdgw1.ge.com)