Greg Wooledge <address@hidden> writes:
> 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
Does bash save the ancestral PID somewhere?
To explain what I mean, this works:
$ readlink /proc/$PPID/exe
/usr/bin/tmux
$ echo $TERM
screen
But this doesn't:
$ sudo bash
# readlink /proc/$PPID/exe
/usr/bin/sudo
# echo $TERM
screen