Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Nov 2009 12:19:45 +0100
From:      Ruben de Groot <mail25@bzerk.org>
To:        Polytropon <freebsd@edvax.de>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: Prompt containing SSH login information
Message-ID:  <20091124111945.GA80567@ei.bzerk.org>
In-Reply-To: <20091124051038.1aef9ade.freebsd@edvax.de>
References:  <20091124051038.1aef9ade.freebsd@edvax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Nov 24, 2009 at 05:10:38AM +0100, Polytropon typed:
> Hi,
> 
> again, a strange question: I'd like to know if there is a builtin
> means to let the csh's (or bash's) prompt show an information if
> the current dialog session has been opened via SSH from another
> system. The obvious is:
> 
> 	me@sys1:~% ssh me@sys2
> 	me@sys2:~% _
> 
> I'd like the second prompt that I've been logged into sys2 by
> sys1, such as
> 
> 	me@sys1>sys2:~% _
> 
> or reverse
> 
> 	me@sys2<sys1:~% _
> 
> or something similar, like the complex form with different user
> names, such as
> 
> 	me@sys1:~% ssh bob@sys2
> 	me@sys1>bob@sys2:~% _
> 
> Is this possible with the means given by the shell? I read "man
> csh", but found nothing that would fit.
> 
> Maybe it's not possible (because not intended)...

In tcsh there's the REMOTEHOST env variable. Don't know about bash.
Something like:

set prompt = "${USER}@${HOST}>${REMOTEHOST}> "

should do it?

Ruben




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091124111945.GA80567>