From owner-freebsd-current@FreeBSD.ORG Thu Oct 7 20:04:54 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7722916A4CE for ; Thu, 7 Oct 2004 20:04:54 +0000 (GMT) Received: from gw.catspoiler.org (217-ip-163.nccn.net [209.79.217.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id AD67543D2D for ; Thu, 7 Oct 2004 20:04:52 +0000 (GMT) (envelope-from truckman@FreeBSD.org) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.13.1/8.13.1) with ESMTP id i97K4eLC059473; Thu, 7 Oct 2004 13:04:44 -0700 (PDT) (envelope-from truckman@FreeBSD.org) Message-Id: <200410072004.i97K4eLC059473@gw.catspoiler.org> Date: Thu, 7 Oct 2004 13:04:40 -0700 (PDT) From: Don Lewis To: danfe@nsu.ru In-Reply-To: <20041007171009.GA36712@regency.nsu.ru> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii cc: nkalev@gmail.com cc: rbgarga@gmail.com cc: freebsd-current@FreeBSD.org Subject: Re: csh is root's shell? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Oct 2004 20:04:54 -0000 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@hostA:~". Then when I ssh to hostB, the titlebar changes to "myusername@hostB:~". When I exit the shell on hostA, the titlebar changes back to "myusername@hostA:~" because the shell on hostA immediately prints the prompt string with the proper escape sequence.