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?
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