1TEE(1P) POSIX Programmer's Manual TEE(1P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 tee - duplicate standard input
13
15 tee [-ai][file...]
16
18 The tee utility shall copy standard input to standard output, making a
19 copy in zero or more files. The tee utility shall not buffer output.
20
21 If the -a option is not specified, output files shall be written (see
22 File Read, Write, and Creation .
23
25 The tee utility shall conform to the Base Definitions volume of
26 IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
27
28 The following options shall be supported:
29
30 -a Append the output to the files.
31
32 -i Ignore the SIGINT signal.
33
34
36 The following operands shall be supported:
37
38 file A pathname of an output file. Processing of at least 13 file op‐
39 erands shall be supported.
40
41
43 The standard input can be of any type.
44
46 None.
47
49 The following environment variables shall affect the execution of tee:
50
51 LANG Provide a default value for the internationalization variables
52 that are unset or null. (See the Base Definitions volume of
53 IEEE Std 1003.1-2001, Section 8.2, Internationalization Vari‐
54 ables for the precedence of internationalization variables used
55 to determine the values of locale categories.)
56
57 LC_ALL If set to a non-empty string value, override the values of all
58 the other internationalization variables.
59
60 LC_CTYPE
61 Determine the locale for the interpretation of sequences of
62 bytes of text data as characters (for example, single-byte as
63 opposed to multi-byte characters in arguments).
64
65 LC_MESSAGES
66 Determine the locale that should be used to affect the format
67 and contents of diagnostic messages written to standard error.
68
69 NLSPATH
70 Determine the location of message catalogs for the processing of
71 LC_MESSAGES .
72
73
75 Default, except that if the -i option was specified, SIGINT shall be
76 ignored.
77
79 The standard output shall be a copy of the standard input.
80
82 The standard error shall be used only for diagnostic messages.
83
85 If any file operands are specified, the standard input shall be copied
86 to each named file.
87
89 None.
90
92 The following exit values shall be returned:
93
94 0 The standard input was successfully copied to all output files.
95
96 >0 An error occurred.
97
98
100 If a write to any successfully opened file operand fails, writes to
101 other successfully opened file operands and standard output shall con‐
102 tinue, but the exit status shall be non-zero. Otherwise, the default
103 actions specified in Utility Description Defaults apply.
104
105 The following sections are informative.
106
108 The tee utility is usually used in a pipeline, to make a copy of the
109 output of some utility.
110
111 The file operand is technically optional, but tee is no more useful
112 than cat when none is specified.
113
115 Save an unsorted intermediate form of the data in a pipeline:
116
117
118 ... | tee unsorted | sort > sorted
119
121 The buffering requirement means that tee is not allowed to use ISO C
122 standard fully buffered or line-buffered writes. It does not mean that
123 tee has to do 1-byte reads followed by 1-byte writes.
124
125 It should be noted that early versions of BSD ignore any invalid
126 options and accept a single '-' as an alternative to -i. They also
127 print a message if unable to open a file:
128
129
130 "tee: cannot access %s\n", <pathname>
131
132 Historical implementations ignore write errors. This is explicitly not
133 permitted by this volume of IEEE Std 1003.1-2001.
134
135 Some historical implementations use O_APPEND when providing append
136 mode; others use the lseek() function to seek to the end-of-file after
137 opening the file without O_APPEND. This volume of IEEE Std 1003.1-2001
138 requires functionality equivalent to using O_APPEND; see File Read,
139 Write, and Creation .
140
142 None.
143
145 Introduction, cat, the System Interfaces volume of
146 IEEE Std 1003.1-2001, lseek()
147
149 Portions of this text are reprinted and reproduced in electronic form
150 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
151 -- Portable Operating System Interface (POSIX), The Open Group Base
152 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
153 Electrical and Electronics Engineers, Inc and The Open Group. In the
154 event of any discrepancy between this version and the original IEEE and
155 The Open Group Standard, the original IEEE and The Open Group Standard
156 is the referee document. The original Standard can be obtained online
157 at http://www.opengroup.org/unix/online.html .
158
159
160
161IEEE/The Open Group 2003 TEE(1P)