csh is root's shell?

Don Lewis truckman at FreeBSD.org
Thu Oct 7 13:04:54 PDT 2004

On  8 Oct, Alexey Dokuchaev wrote:
> On Thu, Oct 07, 2004 at 09:44:52AM -0700, Don Lewis wrote:
>> This is what I use:
>>         set prompt = '%m:%c4 %h%#'
>>         if ($?TERM && $TERM == xterm) then
>>                 set prompt='%{\033]0;%n@%m:%c5\007%}%m:%c %h%#'
>>         endif
>> It adds the last few components of $cwd and the history event number to
>> the prompt.  When running in an xterm, it puts the username, hostname,
>> and the last part of $cwd in the xterm title.
> I use pretty much the same code for setting xterm's titlebar.  However,
> there is one known problem with it: when you leave (^D) your shell,
> being ssh'ed to another machine, titlebar still has that remote host
> name.  If there was a way to retrieve current title string, sigh.
> Unless, of course, I'm missing something here.

I'm not seeing that problem here.  If I'm sitting on hostA with an xterm
window open, the titlebar says "myusername at hostA:~".  Then when I ssh to
hostB, the titlebar changes to "myusername at hostB:~".  When I exit the
shell on hostA, the titlebar changes back to "myusername at hostA:~"
because the shell on hostA immediately prints the prompt string with the
proper escape sequence.

More information about the freebsd-current mailing list