Frage

So I distribute my dotfiles on all my machines. I want to put something like the following in my .zshrc

# Autoload screen if we aren't in it.
if [[ $STY = '' ]] then screen -xR; fi

Which I got from What's in your .zshrc?

But I only want to attach to screen when I ssh to remote hosts... not if I'm on my local machine. Is there an environment variable I can test to see if this is an SSH session or localhost console?

War es hilfreich?

Lösung

Right now I'm going to test the $SSH_TTY variable which seems to be reliable from the few hosts I've tried:

if [[ $STY = '' && $SSH_TTY != '' ]] then screen -xR; fi
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top