Return user's terminal name (POSIX)
tty [-s]
The tty utility writes to the standard output the name of the terminal that is open as standard input. If standard input isn't a terminal (e.g. it is a file such as /dev/null), the string not a tty is output instead.
The -s option is deprecated by POSIX; the effect of this option can be achieved, simply and portably, by redirecting output to /dev/null or by using the Shell builtin, test -c. |
The following command will output //14/dev/con1 if run on node 14, console 1.
tty
The following command will output not a tty since /dev/null causes the isatty() function to return 0.
tty </dev/null