zsh-users
 help / color / mirror / code / Atom feed
From: Dominik Vogt <dominik.vogt@fvwm.org>
To: Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru>,
	zsh-users@sunsite.auc.dk
Subject: Re: Differrent prompt for remote machines
Date: Fri, 30 Mar 2001 12:48:13 +0200	[thread overview]
Message-ID: <20010330124813.A10985@lifebits.de> (raw)
In-Reply-To: <Pine.SV4.4.33.0103301353030.29329-100000@itsrm2.mow.siemens.ru>; from Andrej.Borsenkow@mow.siemens.ru on Fri, Mar 30, 2001 at 01:59:33PM +0400

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@lifebits.de
LifeBits Aktiengesellschaft, Albrechtstr. 9, D-72072 Tuebingen
fon: ++49 (0) 7071/7965-0, fax: ++49 (0) 7071/7965-20


  reply	other threads:[~2001-03-30 10:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-30  9:42 Dominik Vogt
2001-03-30  9:59 ` Andrej Borsenkow
2001-03-30 10:48   ` Dominik Vogt [this message]
2001-03-30 15:55     ` Bart Schaefer
2001-03-31 11:32 ` Zefram
2001-03-31 18:26   ` Stephane Bortzmeyer
2001-03-31 19:14   ` Bart Schaefer
2001-04-01  3:53     ` E. Jay Berkenbilt
2001-04-01  4:41       ` Bart Schaefer
2001-03-31 18:26 ` Stephane Bortzmeyer
2001-04-04 17:21   ` Dominik Vogt
2001-04-02 20:46 ` Matt Pharr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010330124813.A10985@lifebits.de \
    --to=dominik.vogt@fvwm.org \
    --cc=Andrej.Borsenkow@mow.siemens.ru \
    --cc=d.vogt@lifebits.de \
    --cc=zsh-users@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).