1.\" Copyright (c) 1990 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)tty.1 6.3 (Berkeley) 04/23/91 7.\" 8.Dd 9.Dt TTY 1 10.Os 11.Sh NAME 12.Nm tty 13.Nd return user's terminal name 14.Sh SYNOPSIS 15.Nm tty 16.Op Fl s 17.Sh DESCRIPTION 18The 19.Nm tty 20utility writes the name of the terminal attached to standard input 21to standard output. 22The name that is written is the string returned by 23.Xr ttyname 3 . 24If the standard input is not a terminal, the message ``not a tty'' 25is written. 26The options are as follows: 27.Bl -tag -width Ds 28.It Fl s 29Don't write the terminal name; only the exit status is affected 30when this option is specified. 31The 32.Fl s 33option is deprecated in favor of the 34.Dq Li "test -t 0" 35command. 36.El 37.Pp 38.Nm Tty 39exits 0 if the standard input is a terminal, 1 if the standard input is 40not a terminal, and >1 if an error occurs. 41.Sh SEE ALSO 42.Xr test 1 , 43.Xr ttyname 3 44.Sh STANDARDS 45The 46.Nm tty 47function is expected to be 48.Tn POSIX 491003.2 compatible. 50