TTY(1,C) AIX Commands Reference TTY(1,C)
-------------------------------------------------------------------------------
tty
PURPOSE
Writes to standard output the full path name of your work station.
SYNTAX
+------+
tty ---| |---|
+- -s -+
DESCRIPTION
The tty command writes the name of your work station to standard output.
FLAG
-s Suppresses reporting the path name. The exit value has the following
possible meanings:
0 Standard input is a work station.
1 Standard input is not a work station.
2 Invalid flags specified.
If your standard input is not a work station and you do not specify the -s
flag, you get the message "not a tty".
EXAMPLES
1. To display full path name of your work station:
tty
2. To test whether the standard input is a work station:
if tty -s
then
echo 'Enter the text to print:' >/dev/tty
fi
print
If the standard input is a work station, 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 work station, this displays nothing. It
merely prints the text read from the standard input.
Processed November 8, 1990 TTY(1,C) 1
TTY(1,C) AIX Commands Reference TTY(1,C)
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 work station, although it also has another name like
/dev/console or /dev/tty2.
Processed November 8, 1990 TTY(1,C) 2