On Tue, Nov 24, 2009 at 05:10:38AM +0100, Polytropon wrote:
> 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:
> 
>       m...@sys1:~% ssh m...@sys2
>       m...@sys2:~% _
> 
> I'd like the second prompt that I've been logged into sys2 by
> sys1, such as
> 
>       m...@sys1>sys2:~% _
> 
> or reverse
> 
>       m...@sys2<sys1:~% _
> 
> or something similar, like the complex form with different user
> names, such as
> 
>       m...@sys1:~% ssh b...@sys2
>       m...@sys1>b...@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)...

I'd suggest parsing out w(1), or better yet, making use of environmental
variables instead.  The following, for example, are set by ssh:

  SSH_CLIENT
  SSH_CONNECTION
  SSH_TTY

Out of curiosity, why are you wanting to do this?  Are you chaining
connections and need an analog of SHLVL for ssh connections? 

-- 
George
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[email protected]"

Reply via email to