The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

tee - duplicate standard input

 SYNOPSIS



tee [-ai][file...]

 DESCRIPTION

The tee utility will copy standard input to standard output, making a copy in zero or more files. The tee utility will not buffer output.

The options determine if the specified files are overwritten or appended to.

 OPTIONS

The tee utility supports the XBD specification, Utility Syntax Guidelines  .

The following options are supported:

-a 
-a (null)
Append the output to the files rather than overwriting them.
-i 
-i (null)
Ignore the SIGINT signal.

 OPERANDS

The following operands are supported:
file
A pathname of an output file. Processing of at least 13 file operands will be supported.

 STDIN

The standard input can be of any type.

 INPUT FILES

None.

 ENVIRONMENT VARIABLES

The following environment variables affect the execution of tee:
LANG
Provide a default value for the internationalisation variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined.
LC_ALL
If set to a non-empty string value, override the values of all the other internationalisation variables.
LC_CTYPE
Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments).
LC_MESSAGES
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
NLSPATH
Determine the location of message catalogues for the processing of LC_MESSAGES .

 ASYNCHRONOUS EVENTS

Default, except that if the -i option was specified, SIGINT will be ignored.

 STDOUT

The standard output will be a copy of the standard input.

 STDERR

Used only for diagnostic messages.

 OUTPUT FILES

If any file operands are specified, the standard input will be copied to each named file.

 EXTENDED DESCRIPTION

None.

 EXIT STATUS

The following exit values are returned:
0
The standard input was successfully copied to all output files.
>0
An error occurred.

 CONSEQUENCES OF ERRORS

If a write to any successfully opened file operand fails, writes to other successfully opened file operands and standard output will continue, but the exit status will be non-zero. Otherwise, the default actions specified in Utility Description Defaults will apply.

 APPLICATION USAGE

The tee utility is usually used in a pipeline, to make a copy of the output of some utility.

The file operand is technically optional, but tee is no more useful than cat when none is specified.

 EXAMPLES

Save an unsorted intermediate form of the data in a pipeline:

. . . | tee unsorted | sort > sorted 

 FUTURE DIRECTIONS

None.

 SEE ALSO

cat.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]