Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: prompt and ssh



On 2009-05-20 08:02:16 +1200, Atom Smasher wrote:
> On Tue, 19 May 2009, ugaciaka wrote:
>
>> I would like to change the type of zsh prompt the remote client (ssh):  
>> if I connected remotely show differently prompt...
>>
>> What kind of condition if I can put on PS1?
> ==============
>
> you can test for SSH_CONNECTION, SSH_CLIENT, or SSH_TTY on the far side. 
> i would recommend SSH_CONNECTION.

But this will not work well if you use "screen". For instance:
1. Connect to host remote_host by ssh.
2. Start a screen session. SSH_CONNECTION is inherited and the prompt
   will say that you are connected by ssh (this is what you want).
3. Later, log on the machine directly (without ssh) and recall the
   screen session. SSH_CONNECTION is still set (as the environment
   doesn't change in the recalled shell) and the prompt will still
   say that you are connected by ssh, while you are not.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)



Messages sorted by: Reverse Date, Date, Thread, Author