tty(teletypewriter)显示出连接到当前标准输入的终端设备文件名。
tty [OPTION]...-s, --silent, --quiet
什么也不显示,只返回退出状态值。
--help
显示帮助信息。
--version
显示版本信息。当使用 -s, --silent, --quiet 时,返回码为 0 表示标准输入是终端,返回码为 1 表示标准输入不是终端,返回码为 2 表示选项错误,返回码为 3 表示有写错误发生。
(1)显示当前终端设备文件名。
tty
/dev/pts/1(2)什么也不显示,只返回退出状态值。
tty -s
echo $?
0(3)显示帮助信息。
tty --help
Usage: tty [OPTION]...
Print the file name of the terminal connected to standard input.
-s, --silent, --quiet print nothing, only return an exit status
--help display this help and exit
--version output version information and exit
GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
For complete documentation, run: info coreutils 'tty invocation'