TTY(1) COMMAND REFERENCE TTY(1) NAME tty - get terminal name SYNOPSIS tty [ -s ] DESCRIPTION Tty prints the pathname of the user's terminal (found by checking the standard input) unless the -s (silent) option is given. OPTIONS -s Silent. Suppresses output. EXAMPLES The following example shows how tty can be used in a shell script to see if the shell script is being run with standard input as a terminal: #!/bin/sh tty -s if test $? -eq 1 then echo "Input is not from a terminal." else echo "Input is from a terminal." fi RETURN VALUE [0] Standard input is a terminal. [1] Standard input is not a terminal. CAVEATS When using tty in a shell script, it is important to note that if the standard input is being redirected, as in a pipe (|), the terminal name cannot be determined. SEE ALSO test(1sh) and ttyname(3c). Printed 4/6/89 1
%%index%% na:216,75; sy:291,156; de:447,314; op:761,134; ex:895,484; rv:1379,229; ca:1608,288; se:1896,155; %%index%%000000000131