I now share my dotfiles between the various OS X machines I use daily, using Dropbox and symlinks.
However, I have many aliases and functions that need to act differently if I only have a console session at the machine in question, or a full GUI session.
With bash, this is easy to test:
1export EDITOR='nano' 2if [[ -z "$SSH_CONNECTION" && $OSTYPE =~ ^darwin ]]; then 3export EDITOR='mate --wait' 4export TEXEDIT='mate -w -l %d "%s"' 5export LESSEDIT='mate -l %lm %f' 6fi
Now, if I am remotely connected to a machine, then I will get
nano as my editor, but if I am sitting directly in front of it, then it will open Textmate.