I want to automatically be put in a screen
if I log in on a tty (if I'm using e.g. Terminal, I can simply open a new window instead.) I've already figured out the screen
parameters and startup file configurations; I just need a reliable way to check whether the terminal is a tty, a terminal emulator, or something else. As far as I know, there are two main types of terminals: tty's (like the ones you can get to in Linux with ctrlaltF#) and terminal emulators (e.g. Apple Terminal, xterm
, etc.)
What are the different types of terminals one is likely to encounter today, and how can I tell which kind the current session is in from a script?
(I have Linux and Mac systems, and I would like the test to work on both. If it requires a non-standard program, that should be available in the Debian, Ubuntu, and Homebrew repositories.)