*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> tty (1)              



NAME    [Toc]    [Back]

       tty - Returns pathname of terminal device

SYNOPSIS    [Toc]    [Back]

       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    [Toc]    [Back]

       Interfaces  documented  on  this reference page conform to
       industry standards as follows:

       tty:  XCU5.0

       Refer to the standards(5) reference page for more information
 about industry standards and associated tags.

OPTIONS    [Toc]    [Back]

       Suppresses reporting the pathname.

       The  XCU  specification  states that -s option is obsolete
       and recommends the portable applications  use  test  -t  0
       instead of tty -s.

OPERANDS    [Toc]    [Back]


DESCRIPTION    [Toc]    [Back]

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

       [Tru64 UNIX]  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    [Toc]    [Back]

       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 application you  should  use  the
       command test -t 0.

EXIT STATUS    [Toc]    [Back]

       The following exit values are returned: Successful completion.
   Standard  input  is   not   a   display.    [Tru64
       UNIX]  Invalid  options specified.  [Tru64 UNIX]  An error

DIAGNOSTICS    [Toc]    [Back]

       [Tru64 UNIX]  Your standard input is not a display and you
       did not specify the -s option.

EXAMPLES    [Toc]    [Back]

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


       The following environment variables affect  the  execution
       of tty: Provides 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  variables  contain
 an invalid setting, the utility behaves as if none of
       the variables had been defined.  If  set  to  a  non-empty
       string value, overrides the values of all the other internationalization
 variables.  Determines the locale for  the
       interpretation of sequences of bytes of text data as characters
 (for example, single-byte as opposed  to  multibyte
       characters  in  arguments).  Determines the locale for the
       format and contents  of  diagnostic  messages  written  to
       standard  error.  Determines the location of message catalogues
 for the processing of LC_MESSAGES.

FILES    [Toc]    [Back]

       Pseudodevice representing the user's controlling terminal.

SEE ALSO    [Toc]    [Back]

       Commands:  stty(1), test(1)

       Routines:  ttyname(3)

       Files:  tty(7)

       Standards:  standards(5)

[ Back ]
 Similar pages
Name OS Title
ctermid FreeBSD generate terminal pathname
ctermid_r FreeBSD generate terminal pathname
ctermid NetBSD generate terminal pathname
ctermid OpenBSD generate terminal pathname
pxfctermid IRIX Generates terminal pathname
realpath FreeBSD returns the canonicalized absolute pathname
realpath OpenBSD returns the canonicalized absolute pathname
realpath NetBSD returns the canonicalized absolute pathname
ctermid Tru64 Generate the pathname for the controlling terminal
namei Linux follow a pathname until a terminal point is found
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service