Tuesday, November 15, 2011

The tty command

The unix command tty displays the name of the terminal type.tty is the controling terminal interface.
The file /dev/tty is, in each process a synonym for the control terminal assosciated with the process group of that process. It can be used for programs that demand the name of a file for output, when typed output is desired .

Syntax:
            tty[-l][-s]
 The tty command prints the path name of the user terminal.
-l prints the synchronous line number to which the user's terminal is connected, if it is on an active
    synchronous line.
-s inhibits the printing of the terminal path name, allowing one to just test the exit code.
    The exit codes are as follows:
 2 if invalid options were specified
 0 if standard input is a terminal.
 1 otherwise

The error message  not an active synchronous line,  appears if the standard input is not a synchronous terminal and -1 is specified.

The error message  not a tty, appears if the standard input is not a terminal and -s is not specified.

No comments:

Post a Comment