*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: tty | Section: 1 | Source: Digital UNIX | File: tty.1.gz
tty(1) General Commands Manual tty(1) NAME tty - Returns pathname of terminal device SYNOPSIS tty [-s] The tty command writes the full pathname of your terminal device to standard output. The tty command may also be used to determine if standard input is a terminal. STANDARDS Interfaces documented on this reference page conform to industry stan- dards as follows: tty: XPG4, XPG4-UNIX Refer to the standards(5) reference page for more information about in- dustry standards and associated tags. OPTIONS Suppresses reporting the pathname. OPERANDS None DESCRIPTION The command tty -s evaluates as TRUE if standard input is a display and FALSE if it is not. [DIGITAL] The file /dev/tty is a special file always refers to your controlling terminal, although it also may have another name like /dev/console or /dev/tty2. To avoid writing undesirable output to an output file--for example, to write a prompt in a shell script to the screen, while writing the response to the prompt to an output file--redirect standard output to /dev/tty. NOTES While the -s option is useful if only the exit code is wanted, it does not rely on any ability to form a valid pathname. For a portable appli- cation you should use the command test -t 0. EXIT STATUS The following exit values are returned: Successful completion. Stan- dard input is not a display. [DIGITAL] Invalid options specified. [DIGITAL] An error occurred. DIAGNOSTICS [DIGITAL] Your standard input is not a display and you did not specify the -s option. EXAMPLES To display full pathname of your terminal device, enter: tty To test whether or not the standard input is a terminal device, create a shell script containing the following: if tty -s then echo 'Output is a display' else echo 'Output is not a display' fi If the standard input is a terminal device, this displays the Output is a display message. If the standard input is not a ter- minal device, it displays the Output is not a display message. ENVIRONMENT VARIABLES The following environment variables affect the execution of tty: Pro- vides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, over- rides the values of all the other internationalization variables. De- termines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi- byte characters in arguments). Determines the locale for the format and contents of diagnostic messages written to standard error. Deter- mines the location of message catalogues for the processing of LC_MES- SAGES. FILES Pseudodevice representing the user's controlling terminal. SEE ALSO Commands: stty(1), test(1) Routines: ttyname(3) Files: tty(7) Standards: standards(5) tty(1)

Navigation Options