Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!uunet!mstan!chuck From: chuck@Morgan.COM (Chuck Ocheret) Newsgroups: comp.windows.x Subject: Re: (how to) place cwd in title bar Message-ID: <3213@s5.Morgan.COM> Date: 6 May 91 16:44:17 GMT References: <1991May2.195905.5199@garfield.cs.mun.ca> Organization: Morgan Stanley, & Co., Inc. / New York City, NY Lines: 30 The problem with modifying cd to set your title bar to show pwd is that you may return from a subshell (or rlogin, rsh, etc...) where you did a cd and now your title bar is incorrect. If you can modify your prompt dynamically to include the escape sequence things work better. Korn shell users must also fool the shell into believing the prompt to be shorter than it is with the escape sequence enclosed otherwise it wraps lines too soon. The following works for me in my .envfile. PS1="$(hostname) "'${PWD}' if [[ $(whoami) = root ]] # different prompt for root then PEND='!# ' else PEND='!$ ' fi if [[ xx = x${CONSOLE}x ]] # console window should say CONSOLE then if [[ ${TERM} = xterm ]] then PS1="^[]2;${PS1}^G^M${PEND}" else PS1="${PS1} ${PEND}" fi else PS1="${PS1} ${PEND}" fi Where ^[ is escape, ^G is control-G and ^M is control-M. ~chuck -- +--------------------+ Chuck Ocheret +---------------+ |chuck@fid.Morgan.COM| Morgan Stanley & Co., Inc. |(212) 703-4474 | | Duty now ... |19th Floor, 1251 Avenue of the Americas|for the future.| +--------------------+ New York, N.Y. 10020 USA +---------------+