Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Differrent prompt for remote machines
- X-seq: zsh-users 3777
 
- From: Dominik Vogt <dominik.vogt@xxxxxxxx>
 
- To: Andrej Borsenkow <Andrej.Borsenkow@xxxxxxxxxxxxxx>,	zsh-users@xxxxxxxxxxxxxx
 
- Subject: Re: Differrent prompt for remote machines
 
- Date: Fri, 30 Mar 2001 12:48:13 +0200
 
- In-reply-to: <Pine.SV4.4.33.0103301353030.29329-100000@xxxxxxxxxxxxxxxxxxxxx>; from Andrej.Borsenkow@xxxxxxxxxxxxxx on Fri, Mar 30, 2001 at 01:59:33PM +0400
 
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
 
- References: <20010330114228.O1115@xxxxxxxxxxx> <Pine.SV4.4.33.0103301353030.29329-100000@xxxxxxxxxxxxxxxxxxxxx>
 
- Reply-to: d.vogt@xxxxxxxxxxx
 
- Sender: dvogt@xxxxxxxxxxx
 
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:
> >
> >       <username> ...
> >
> >     and
> >
> >       <username>@<machine> ...
> >
> >     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@xxxxxxxxxxx
LifeBits Aktiengesellschaft, Albrechtstr. 9, D-72072 Tuebingen
fon: ++49 (0) 7071/7965-0, fax: ++49 (0) 7071/7965-20
Messages sorted by:
Reverse Date,
Date,
Thread,
Author