NAME
tty
—
get path to current teletype
SYNOPSIS
tty |
[-s ] |
DESCRIPTION
Write the path of the tty connected to the standard input stream, or "not a tty", followed by a newline, to the standard output stream, and exit successfully only if it is.
OPTIONS
-s
,--silent
,--quiet
- Don't write anything, use isatty(3).
EXIT STATUS
- 2
- an error occurred,
- 1
- the standard input stream is not attached to a teletype (or its name is undeterminable), and
- 0
- otherwise.
SEE ALSO
STANDARDS
Conforms to IEEE Std 1003.1-2008 (“POSIX.1”). The long flags are an extension, originating from the GNU system.
IEEE Std 1003.2-1992
(“POSIX.2”) specifies -s
, but
notes it as obsolescent, pointing toward the use of
test
-t
0 instead. IEEE Std 1003.1-2001
(“POSIX.1”) removes it.
HISTORY
Appears in the first edition of the UNIX Programmer's Manual as
tty -- get tty
name
tty
n" or
"not a tty
" if the standard input file is
not a typewriter (actually "Not a tty.
").
Version 7 AT&T UNIX introduced
-s
, initially undocumented, and switched to the new
ttyname(3) function, arriving at the
tty
of today.