Writes to standard output the full path name of your terminal.
/usr/bin/tty [ -s ]
The tty command writes the name of your terminal to standard output.
If your standard input is not a terminal and you do not specify the -s flag, you get the message Standard input is not a tty.
The following environment
variables affect the execution of the tty command:
-s | Suppresses reporting the path name. |
This command returns the
following exit values:
0 | Standard input is a terminal. |
1 | Standard input is not a terminal. |
>1 | An error occurred. |
tty
If the standard input is a terminal, this displays the message "Enter the text to print:" as a prompt and prints the text that the user types. If the standard input is not a terminal, this displays nothing; it merely prints the text read from the standard input.
The echo . . . >/dev/tty displays the prompt on the screen even if you redirect the standard output of the shell procedure. This way the prompt is never written into an output file. The special file /dev/tty always refers to your terminal, although it also has another name such as /dev/console or /dev/tty2.
/usr/bin/tty | Contains the tty command. |
/dev/tty | Specifies the tty pseudo device. |
The National Language Support Overview for Programming in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs discusses the LC_ variables.