tty(1)


tty -- get the name of the terminal

Synopsis

tty [-l] [-s]

Description

tty prints the pathname of the user's terminal. It accepts the following options:

-l
Print the synchronous line number to which the user's terminal is connected, if it is on an active synchronous line.

-s
Inhibit printing of the terminal path name, allowing one to test just the exit code.

Files

/usr/lib/locale/locale/LC_MESSAGES/uxue.abi
language-specific message file (see LANG on environ(5)).

Exit codes

0
standard input is a terminal

1
standard input is not a terminal

2
invalid option

Diagnostics

not on an active synchronous line
The standard input is not a synchronous terminal and -l is specified.

not a tty
The standard input is not a terminal and -s is not specified.

References

ttyname(3C)

Notices

Application authors should avoid use of the -s option, since it may not be supported in future releases. Use test -t 0 in its place.
30 January 1998
© 1998 The Santa Cruz Operation, Inc. All rights reserved.