tty(1)								       tty(1)



NAME
  tty - Returns pathname of terminal device

SYNOPSIS

  tty [-s]

  The tty command writes the full pathname of your terminal device to stan-
  dard output.

DESCRIPTION

  tty -s evaluates as TRUE if standard output is a display and FALSE if it is
  not.

  /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.

FLAGS

  -s  Suppresses reporting the pathname.

EXAMPLES

   1.  To display full pathname of your terminal device, enter:
	    tty


   2.  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 terminal device,
       it displays the Output is not a display message.

DIAGNOSTICS

  Standard input is not a tty
      Your standard input is not a display and you did not specify the -s
      flag.




EXIT VALUES

  The exit value has the following possible meanings:

  0   Standard output is a display.

  1   Standard input is not a display.

  2   Invalid flags specified.

FILES

  /dev/tty
	 Pseudodevice representing the user's controlling terminal.

RELATED INFORMATION

  Commands:  stty(1).

  Files:  tty(7).