1tty(1) User Commands tty(1)
2
3
4
6 tty - return user's terminal name
7
9 /usr/bin/tty [-l] [-s]
10
11
12 ksh93
13 tty [ options ]
14
15
17 /usr/bin/tty
18 The tty utility writes to the standard output the name of the terminal
19 that is open as standard input. The name that is used is equivalent to
20 the string that would be returned by the ttyname(3C) function.
21
22 ksh93
23 The ksh93 tty built-in writes the name of the terminal that is con‐
24 nected to standard input onto standard output. If the standard input is
25 not a terminal, "not a tty" will be written to standard output.
26
28 The following options are supported:
29
30 /usr/bin/tty
31 -l Prints the synchronous line number to which the user's terminal
32 is connected, if it is on an active synchronous line.
33
34
35 -s Inhibits printing of the terminal path name, allowing one to test
36 just the exit status.
37
38
39 ksh93
40 -l Write the synchronous line number of the terminal on
41 --line-number a separate line following the terminal name line. If
42 the standard input is not a synchronous terminal then
43 "not on an active synchronous line" is written.
44
45
46 -s Disable the terminal name line. Portable applications
47 --silent|quiet should use [[ -t 0 ]] instead.
48
49
51 See environ(5) for descriptions of the following environment variables
52 that affect the execution of tty: LANG, LC_ALL, LC_CTYPE, LC_MES‐
53 SAGES, and NLSPATH.
54
56 The following exit values are returned:
57
58 0 Standard input is a terminal.
59
60
61 1 Standard input is not a terminal.
62
63
64 >1 An error occurred.
65
66
68 See attributes(5) for descriptions of the following attributes:
69
70
71
72
73 ┌─────────────────────────────┬─────────────────────────────┐
74 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
75 ├─────────────────────────────┼─────────────────────────────┤
76 │Availability │SUNWcsu │
77 ├─────────────────────────────┼─────────────────────────────┤
78 │CSI │Enabled │
79 ├─────────────────────────────┼─────────────────────────────┤
80 │Interface Stability │Committed │
81 ├─────────────────────────────┼─────────────────────────────┤
82 │Standard │standards(5). │
83 └─────────────────────────────┴─────────────────────────────┘
84
86 isatty(3C), ttyname(3C), attributes(5), environ(5), standards(5)
87
89 not on an active synchronous line
90
91 The standard input is not a synchronous terminal and -l is speci‐
92 fied.
93
94
95 not a tty
96
97 The standard input is not a terminal and -s is not specified.
98
99
101 The -s option is useful only if the exit status is wanted. It does not
102 rely on the ability to form a valid path name. Portable applications
103 should use test -t.
104
105
106
107SunOS 5.11 11 Aug 2009 tty(1)