Return the user's terminal name (POSIX)
- Be silent; don't output the terminal name. This option is useful if you're concerned only with tty's exit status.
The tty utility writes to the standard output the name of the terminal that's open as standard input. If standard input isn't a terminal (e.g. it's a file such as /dev/null), the string not a tty is output instead.
|The -s option is deprecated by POSIX; you can achieve the effect of this option, simply and portably, by redirecting output to /dev/null or by using the shell builtin, test -c.|
The following command prints /dev/con1 if run on console 1:
The following command prints not a tty because /dev/null causes isatty() to return 0:
- > 0
- An error occurred.