Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use $SSH_CONNECTION #2

Merged
merged 1 commit into from
Sep 30, 2017
Merged

Use $SSH_CONNECTION #2

merged 1 commit into from
Sep 30, 2017

Conversation

jupl
Copy link
Contributor

@jupl jupl commented Sep 27, 2017

I've been using this for a while but recently noticed an inconsistency with showing the hostname. I'm using tmux, having one session when on the computer directly and a separate session when I connect via SSH. One of two scenarios occur:

  1. If I start a session first in the computer directly, the hostname does not show. However, if I then start a session via SSH while the other session is still open the hostname still doesn't show.

  2. If I start a session first via SSH, the hostname does show. However, if I then start a session directly while the other session is open the hostname still shows.

In both cases I observe the environment variables and it seems that SSH_CLIENT and SSH_TTY are not reliable in determining if I'm in an SSH session. The only environment variable that is consistent is SSH_CONNECTION, plus other ZSH themes I've observed also use SSH_CONNECTION. I also tried using SSH_CONNECTION without tmux and it seems to work properly.

@agkozak
Copy link
Owner

agkozak commented Sep 27, 2017

Many thanks for your contribution, @jupl ! I'll play around with this on the dev branch for a couple of days.

I'm half inclined to test for all three environment variables, just to be safe -- but I like to be economical, as well.

@agkozak agkozak merged commit b9b132b into agkozak:master Sep 30, 2017
@agkozak
Copy link
Owner

agkozak commented Sep 30, 2017

@jupl I have merged your commit and added another of my own so that there are tests for all three environment variables.

@jupl
Copy link
Contributor Author

jupl commented Oct 3, 2017

Ah. Got it. I will note that issue 2 is still present unfortunately.

@jupl jupl deleted the use-ssh-connection branch October 3, 2017 22:33
@agkozak
Copy link
Owner

agkozak commented Oct 3, 2017

@jupl, sorry to have closed this pull request prematurely. I have reopened the second issue in #3 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants