I’ve got a script that will open a new tab in the OS X Terminal application and I’m trying to add support for iTerm2. Unfortunately, the methods to open tabs in the two terminal emulators are different.
How could I tell which of the two is being used, or is open, to conditionally run the correct script?
I’m not sure how to tell iTerm and iTerm2 apart, but check the
$TERM_PROGRAMenvar. For me (Mac OS X 10.7), it returnsApple_TerminalforTerminal.app, andiTerm.appfor iTerm2.