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

Re: prompt and ssh

On Thu, 21 May 2009, Vincent Lefevre wrote:

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.

that's a limitation of screen. whatever environment is available when a session starts will always be with that session.

you ~could~ manually un/set SSH_* and then re-source the zshrc...?


 762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808

	"Since trade ignores national boundaries and the manufacturer
	 insists on having the world as a market, the flag of his
	 nation must follow him, and the doors of the nations which
	 are closed against him must be battered down. Concessions
	 obtained by financiers must be safeguarded by ministers of
	 state, even if the sovereignty of unwilling nations be
	 outraged in the process. Colonies must be obtained or
	 planted, in order that no useful corner of the world may be
	 overlooked or left unused."
		-- Woodrow Wilson,
		President of the United States, 1919

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