From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24362 invoked from network); 30 Mar 2001 09:59:53 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 30 Mar 2001 09:59:53 -0000 Received: (qmail 6577 invoked by alias); 30 Mar 2001 09:59:37 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3776 Received: (qmail 6565 invoked from network); 30 Mar 2001 09:59:36 -0000 X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer david.siemens.de) Date: Fri, 30 Mar 2001 13:59:33 +0400 (MSD) From: Andrej Borsenkow X-X-Sender: To: Dominik Vogt cc: Subject: Re: Differrent prompt for remote machines In-Reply-To: <20010330114228.O1115@lifebits.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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. -andrej