Because you (lovely) people are always so curious about posters' original intents, here's mine:
If I'm on a Mac and have a GUI (as opposed to, say, being on an ssh session), I want to set my
$EDITOR
tomate_wait
. (And go withvim
otherwise.)
And, you have an answer for that. I do too. It even works. Here. Sometimes.
So I want you to fiercely scrutinize it:
Skip intro
I can tell that I'm on a Mac by checking:
[ `uname` = 'Darwin' ]
And I think I can sort of tell that I have a GUI by checking:
[ "$TERM_PROGRAM" = 'Apple_Terminal' ]
# or
[ "$DISPLAY" ]
Now, it's theoretically possible that I have an Aqua-less OpenDarwin setup running X11. It's also possible that I'm running fully lickable Mac GUI, yet using another terminal application.
And then there's the mind-bending possibility that I'm running xterm within Apple's X11 running on top of the OS X GUI. In which case I'd still want mate_wait
as $EDITOR
.
For OCD's sake, I'd like my checks to be as precise as possible.
So, please, un-reckless-fy my code.