On Thu, Jun 11, 2015 at 09:40:18AM -0500, Peng Yu wrote:
> Hi, I see the $TERM variable is available in bash, but it is not in
> the manual. Does anybody know where it comes from and where it is
> documented? Thanks.
Bash inherits it from its parent process, which is typically one of:
* an X terminal emulator like xterm
* a terminal multiplexer like screen or tmux
* the getty/login team on a serial connection or operating system console
* sshd, which in turn gets TERM from the ssh remote client
In the absence of TERM, or even sometimes despite its presence, some
operating system standard dot-files (~/.profile or /etc/profile)
will still run a program to query the terminal type interactively.
You probably won't see this much on Linux, but it's rampant on commercial
unices.