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