tty
Official Description
Returns the pathname of the terminal device.
Syntax
tty [-s]
Options
-s suppresses reporting the pathname. (It might be useful to check for the existence of a terminal device.)
Oddities
It can be used to determine whether the standard input is a terminal.
Example
$ tty # Current terminal device /dev/pts/0 $ $ tty –s # If successful, stdin is a tty $ print $? 0 $
Get Korn Shell Programming by Example now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.