From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24711 invoked from network); 30 Mar 2001 10:48:53 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 30 Mar 2001 10:48:53 -0000 Received: (qmail 18265 invoked by alias); 30 Mar 2001 10:48:39 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3777 Received: (qmail 18252 invoked from network); 30 Mar 2001 10:48:39 -0000 X-Authentication-Warning: erdbeere.lifebits.local: luthien set sender to dvogt@lifebits.de using -f Date: Fri, 30 Mar 2001 12:48:13 +0200 From: Dominik Vogt To: Andrej Borsenkow , zsh-users@sunsite.auc.dk Subject: Re: Differrent prompt for remote machines Message-ID: <20010330124813.A10985@lifebits.de> Reply-To: d.vogt@lifebits.de References: <20010330114228.O1115@lifebits.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from Andrej.Borsenkow@mow.siemens.ru on Fri, Mar 30, 2001 at 01:59:33PM +0400 Sender: dvogt@lifebits.de X-Sender: 520008918237-0001@t-dialin.net On Fri, Mar 30, 2001 at 01:59:33PM +0400, Andrej Borsenkow wrote: > On Fri, 30 Mar 2001, Dominik Vogt wrote: > > > I want to solve the following problem: > > > > I'm often logged in to different machines that all share the > > same zsh configuration files (via ssh or telnet). But I > > frequently forget on which machine I am, mainly because either > > I have the machine name in my promt for all machines or for no > > machine at all. What I'd like to have is this: > > > > For the machine at which I logged in: > > > > ... > > > > and > > > > @ ... > > > > for remote logins (and possibly the machine name in bright > > red for our server and in a different colour for other remote > > machines). > > > > Basically it breaks down to detecting if the shell runs on a > > local terminal or through a network connection. > > > > One possibility is to use finger (is it available on all systems?) > Something like > > finger -f > root Super-User console 3 Tue 17:02 > root Super-User pts/1 Fri 09:00 foo.bar.com > > then check for current line and see if the last field is empty. Solaris > supports who -m: > > # who -m > root pts/1 Mar 30 09:00 (foo.bar.com) > > that basically gives the same information, but it depends on system, of > course. > > You could check for pty, but it won't catch the case when you run under > X11. Thanks, I got it working with 'who -m | cut -d "!" -f 1'. Now there's only the problem of setting the colours, but I think I'll stick to underline/standout/bold mode in the prompt to keep this portable. Bye Dominik ^_^ ^_^ -- Dominik Vogt, email: d.vogt@lifebits.de LifeBits Aktiengesellschaft, Albrechtstr. 9, D-72072 Tuebingen fon: ++49 (0) 7071/7965-0, fax: ++49 (0) 7071/7965-20