logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

tee.1p (5901B)


  1. '\" et
  2. .TH TEE "1P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. tee
  12. \(em duplicate standard input
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. tee \fB[\fR-ai\fB] [\fIfile\fR...\fB]\fR
  17. .fi
  18. .SH DESCRIPTION
  19. The
  20. .IR tee
  21. utility shall copy standard input to standard output, making a copy in
  22. zero or more files. The
  23. .IR tee
  24. utility shall not buffer output.
  25. .P
  26. If the
  27. .BR \-a
  28. option is not specified, output files shall be written (see
  29. .IR "Section 1.1.1.4" ", " "File Read" ", " "Write" ", " "and Creation".
  30. .SH OPTIONS
  31. The
  32. .IR tee
  33. utility shall conform to the Base Definitions volume of POSIX.1\(hy2017,
  34. .IR "Section 12.2" ", " "Utility Syntax Guidelines".
  35. .P
  36. The following options shall be supported:
  37. .IP "\fB\-a\fP" 10
  38. Append the output to the files.
  39. .IP "\fB\-i\fP" 10
  40. Ignore the SIGINT signal.
  41. .SH OPERANDS
  42. The following operands shall be supported:
  43. .IP "\fIfile\fR" 10
  44. A pathname of an output file. If a
  45. .IR file
  46. operand is
  47. .BR '\-' ,
  48. it shall refer to a file named
  49. .BR \- ;
  50. implementations shall not treat it as meaning standard output.
  51. Processing of at least 13
  52. .IR file
  53. operands shall be supported.
  54. .SH STDIN
  55. The standard input can be of any type.
  56. .SH "INPUT FILES"
  57. None.
  58. .SH "ENVIRONMENT VARIABLES"
  59. The following environment variables shall affect the execution of
  60. .IR tee :
  61. .IP "\fILANG\fP" 10
  62. Provide a default value for the internationalization variables that are
  63. unset or null. (See the Base Definitions volume of POSIX.1\(hy2017,
  64. .IR "Section 8.2" ", " "Internationalization Variables"
  65. for the precedence of internationalization variables used to determine
  66. the values of locale categories.)
  67. .IP "\fILC_ALL\fP" 10
  68. If set to a non-empty string value, override the values of all the
  69. other internationalization variables.
  70. .IP "\fILC_CTYPE\fP" 10
  71. Determine the locale for the interpretation of sequences of bytes of
  72. text data as characters (for example, single-byte as opposed to
  73. multi-byte characters in arguments).
  74. .IP "\fILC_MESSAGES\fP" 10
  75. .br
  76. Determine the locale that should be used to affect the format and
  77. contents of diagnostic messages written to standard error.
  78. .IP "\fINLSPATH\fP" 10
  79. Determine the location of message catalogs for the processing of
  80. .IR LC_MESSAGES .
  81. .SH "ASYNCHRONOUS EVENTS"
  82. Default, except that if the
  83. .BR \-i
  84. option was specified, SIGINT shall be ignored.
  85. .SH STDOUT
  86. The standard output shall be a copy of the standard input.
  87. .SH STDERR
  88. The standard error shall be used only for diagnostic messages.
  89. .SH "OUTPUT FILES"
  90. If any
  91. .IR file
  92. operands are specified, the standard input shall be copied to each
  93. named file.
  94. .SH "EXTENDED DESCRIPTION"
  95. None.
  96. .SH "EXIT STATUS"
  97. The following exit values shall be returned:
  98. .IP "\00" 6
  99. The standard input was successfully copied to all output files.
  100. .IP >0 6
  101. An error occurred.
  102. .SH "CONSEQUENCES OF ERRORS"
  103. If a write to any successfully opened
  104. .IR file
  105. operand fails, writes to other successfully opened
  106. .IR file
  107. operands and standard output shall continue, but the exit status shall
  108. be non-zero. Otherwise, the default actions specified in
  109. .IR "Section 1.4" ", " "Utility Description Defaults"
  110. apply.
  111. .LP
  112. .IR "The following sections are informative."
  113. .SH "APPLICATION USAGE"
  114. The
  115. .IR tee
  116. utility is usually used in a pipeline, to make a copy of the output of
  117. some utility.
  118. .P
  119. The
  120. .IR file
  121. operand is technically optional, but
  122. .IR tee
  123. is no more useful than
  124. .IR cat
  125. when none is specified.
  126. .SH EXAMPLES
  127. Save an unsorted intermediate form of the data in a pipeline:
  128. .sp
  129. .RS 4
  130. .nf
  131. \&... | tee unsorted | sort > sorted
  132. .fi
  133. .P
  134. .RE
  135. .SH RATIONALE
  136. The buffering requirement means that
  137. .IR tee
  138. is not allowed to use ISO\ C standard fully buffered or line-buffered writes. It
  139. does not mean that
  140. .IR tee
  141. has to do 1-byte reads followed by 1-byte writes.
  142. .P
  143. It should be noted that early versions of BSD ignore any invalid
  144. options and accept a single
  145. .BR '\-'
  146. as an alternative to
  147. .BR \-i .
  148. They also print a message if unable to open a file:
  149. .sp
  150. .RS 4
  151. .nf
  152. "tee: cannot access %s\en", <\fIpathname\fP>
  153. .fi
  154. .P
  155. .RE
  156. .P
  157. Historical implementations ignore write errors. This is explicitly not
  158. permitted by this volume of POSIX.1\(hy2017.
  159. .P
  160. Some historical implementations use O_APPEND when providing append
  161. mode; others use the
  162. \fIlseek\fR()
  163. function to seek to the end-of-file after opening the file without
  164. O_APPEND. This volume of POSIX.1\(hy2017 requires functionality equivalent to using O_APPEND;
  165. see
  166. .IR "Section 1.1.1.4" ", " "File Read" ", " "Write" ", " "and Creation".
  167. .SH "FUTURE DIRECTIONS"
  168. None.
  169. .SH "SEE ALSO"
  170. .IR "Chapter 1" ", " "Introduction",
  171. .IR "\fIcat\fR\^"
  172. .P
  173. The Base Definitions volume of POSIX.1\(hy2017,
  174. .IR "Chapter 8" ", " "Environment Variables",
  175. .IR "Section 12.2" ", " "Utility Syntax Guidelines"
  176. .P
  177. The System Interfaces volume of POSIX.1\(hy2017,
  178. .IR "\fIlseek\fR\^(\|)"
  179. .\"
  180. .SH COPYRIGHT
  181. Portions of this text are reprinted and reproduced in electronic form
  182. from IEEE Std 1003.1-2017, Standard for Information Technology
  183. -- Portable Operating System Interface (POSIX), The Open Group Base
  184. Specifications Issue 7, 2018 Edition,
  185. Copyright (C) 2018 by the Institute of
  186. Electrical and Electronics Engineers, Inc and The Open Group.
  187. In the event of any discrepancy between this version and the original IEEE and
  188. The Open Group Standard, the original IEEE and The Open Group Standard
  189. is the referee document. The original Standard can be obtained online at
  190. http://www.opengroup.org/unix/online.html .
  191. .PP
  192. Any typographical or formatting errors that appear
  193. in this page are most likely
  194. to have been introduced during the conversion of the source files to
  195. man page format. To report such errors, see
  196. https://www.kernel.org/doc/man-pages/reporting_bugs.html .