Un outil pour savoir si une commande est posix - retour accueil
git clone git://bebou.netlib.re/isposix
Log | Files | Refs | README |
tee.html (11468B)
1 <!-- Copyright 2001-2024 IEEE and The Open Group, All Rights Reserved --> 2 <!DOCTYPE HTML> 3 <html lang="en"> 4 <head> 5 <meta name="generator" content="HTML Tidy for HTML5 for Linux version 5.8.0"> 6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 7 <link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group rhtm tool v1.2.4 --> 8 <!-- Copyright (c) 2001-2024 The Open Group, All Rights Reserved --> 9 <title>tee</title> 10 </head> 11 <body bgcolor="white"> 12 <div class="NAVHEADER"> 13 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0"> 14 <tr class="nav"> 15 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/talk.html" accesskey="P"><<< 16 Previous</a></td> 17 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td> 18 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/test.html" accesskey="N">Next >>></a></td> 19 </tr> 20 </table> 21 <hr align="left" width="100%"></div> 22 <script language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> 23 <center><font size="2">The Open Group Base Specifications Issue 8<br> 24 IEEE Std 1003.1-2024<br> 25 Copyright © 2001-2024 The IEEE and The Open Group</font></center> 26 <hr size="2" noshade> 27 <a name="top" id="top"></a> <a name="tee" id="tee"></a> <a name="tag_20_120" id="tag_20_120"></a><!-- tee --> 28 <h4 class="mansect"><a name="tag_20_120_01" id="tag_20_120_01"></a>NAME</h4> 29 <blockquote>tee — duplicate standard input</blockquote> 30 <h4 class="mansect"><a name="tag_20_120_02" id="tag_20_120_02"></a>SYNOPSIS</h4> 31 <blockquote class="synopsis"> 32 <p><code><tt>tee</tt> <b>[</b><tt>-ai</tt><b>] [</b><i>file</i><tt>...</tt><b>]</b></code></p> 33 </blockquote> 34 <h4 class="mansect"><a name="tag_20_120_03" id="tag_20_120_03"></a>DESCRIPTION</h4> 35 <blockquote> 36 <p>The <i>tee</i> utility shall copy standard input to standard output, making a copy in zero or more files. The <i>tee</i> utility 37 shall not buffer output.</p> 38 <p>If the <b>-a</b> option is not specified, output files shall be written (see <a href= 39 "../utilities/V3_chap01.html#tag_18_01_01_04"><i>1.1.1.4 File Read, Write, and Creation</i></a> ).</p> 40 </blockquote> 41 <h4 class="mansect"><a name="tag_20_120_04" id="tag_20_120_04"></a>OPTIONS</h4> 42 <blockquote> 43 <p>The <i>tee</i> utility shall conform to XBD <a href="../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax 44 Guidelines</i></a> .</p> 45 <p>The following options shall be supported:</p> 46 <dl compact> 47 <dd></dd> 48 <dt><b>-a</b></dt> 49 <dd>Append the output to the files.</dd> 50 <dt><b>-i</b></dt> 51 <dd>Ignore the SIGINT signal.</dd> 52 </dl> 53 </blockquote> 54 <h4 class="mansect"><a name="tag_20_120_05" id="tag_20_120_05"></a>OPERANDS</h4> 55 <blockquote> 56 <p>The following operands shall be supported:</p> 57 <dl compact> 58 <dd></dd> 59 <dt><i>file</i></dt> 60 <dd>A pathname of an output file. If a <i>file</i> operand is <tt>'-'</tt>, it shall refer to a file named <b>-</b>; 61 implementations shall not treat it as meaning standard output. Processing of at least 13 <i>file</i> operands shall be 62 supported.</dd> 63 </dl> 64 </blockquote> 65 <h4 class="mansect"><a name="tag_20_120_06" id="tag_20_120_06"></a>STDIN</h4> 66 <blockquote> 67 <p>The standard input can be of any type.</p> 68 </blockquote> 69 <h4 class="mansect"><a name="tag_20_120_07" id="tag_20_120_07"></a>INPUT FILES</h4> 70 <blockquote> 71 <p>None.</p> 72 </blockquote> 73 <h4 class="mansect"><a name="tag_20_120_08" id="tag_20_120_08"></a>ENVIRONMENT VARIABLES</h4> 74 <blockquote> 75 <p>The following environment variables shall affect the execution of <i>tee</i>:</p> 76 <dl compact> 77 <dd></dd> 78 <dt><i>LANG</i></dt> 79 <dd>Provide a default value for the internationalization variables that are unset or null. (See XBD <a href= 80 "../basedefs/V1_chap08.html#tag_08_02"><i>8.2 Internationalization Variables</i></a> for the precedence of internationalization 81 variables used to determine the values of locale categories.)</dd> 82 <dt><i>LC_ALL</i></dt> 83 <dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd> 84 <dt><i>LC_CTYPE</i></dt> 85 <dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as 86 opposed to multi-byte characters in arguments).</dd> 87 <dt><i>LC_MESSAGES</i></dt> 88 <dd><br> 89 Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.</dd> 90 <dt><i>NLSPATH</i></dt> 91 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 92 Determine the location of messages objects and message catalogs. <img src="../images/opt-end.gif" alt="[Option End]" border= 93 "0"></dd> 94 </dl> 95 </blockquote> 96 <h4 class="mansect"><a name="tag_20_120_09" id="tag_20_120_09"></a>ASYNCHRONOUS EVENTS</h4> 97 <blockquote> 98 <p>Default, except that if the <b>-i</b> option was specified, SIGINT shall be ignored.</p> 99 </blockquote> 100 <h4 class="mansect"><a name="tag_20_120_10" id="tag_20_120_10"></a>STDOUT</h4> 101 <blockquote> 102 <p>The standard output shall be a copy of the standard input.</p> 103 </blockquote> 104 <h4 class="mansect"><a name="tag_20_120_11" id="tag_20_120_11"></a>STDERR</h4> 105 <blockquote> 106 <p>The standard error shall be used only for diagnostic messages.</p> 107 </blockquote> 108 <h4 class="mansect"><a name="tag_20_120_12" id="tag_20_120_12"></a>OUTPUT FILES</h4> 109 <blockquote> 110 <p>If any <i>file</i> operands are specified, the standard input shall be copied to each named file.</p> 111 </blockquote> 112 <h4 class="mansect"><a name="tag_20_120_13" id="tag_20_120_13"></a>EXTENDED DESCRIPTION</h4> 113 <blockquote> 114 <p>None.</p> 115 </blockquote> 116 <h4 class="mansect"><a name="tag_20_120_14" id="tag_20_120_14"></a>EXIT STATUS</h4> 117 <blockquote> 118 <p>The following exit values shall be returned:</p> 119 <dl compact> 120 <dd></dd> 121 <dt> 0</dt> 122 <dd>The standard input was successfully copied to all output files.</dd> 123 <dt>>0</dt> 124 <dd>An error occurred.</dd> 125 </dl> 126 </blockquote> 127 <h4 class="mansect"><a name="tag_20_120_15" id="tag_20_120_15"></a>CONSEQUENCES OF ERRORS</h4> 128 <blockquote> 129 <p>If a write to any successfully opened <i>file</i> operand fails, writes to other successfully opened <i>file</i> operands and 130 standard output shall continue, but the exit status shall be non-zero. Otherwise, the default actions specified in <a href= 131 "../utilities/V3_chap01.html#tag_18_04"><i>1.4 Utility Description Defaults</i></a> apply.</p> 132 </blockquote> 133 <hr> 134 <div class="box"><em>The following sections are informative.</em></div> 135 <h4 class="mansect"><a name="tag_20_120_16" id="tag_20_120_16"></a>APPLICATION USAGE</h4> 136 <blockquote> 137 <p>The <i>tee</i> utility is usually used in a pipeline, to make a copy of the output of some utility.</p> 138 <p>The <i>file</i> operand is technically optional, but <i>tee</i> is no more useful than <a href= 139 "../utilities/cat.html"><i>cat</i></a> when none is specified.</p> 140 </blockquote> 141 <h4 class="mansect"><a name="tag_20_120_17" id="tag_20_120_17"></a>EXAMPLES</h4> 142 <blockquote> 143 <p>Save an unsorted intermediate form of the data in a pipeline:</p> 144 <pre> 145 <tt>... | tee unsorted | sort > sorted 146 </tt></pre></blockquote> 147 <h4 class="mansect"><a name="tag_20_120_18" id="tag_20_120_18"></a>RATIONALE</h4> 148 <blockquote> 149 <p>The buffering requirement means that <i>tee</i> is not allowed to use ISO C standard fully buffered or line-buffered 150 writes. It does not mean that <i>tee</i> has to do 1-byte reads followed by 1-byte writes.</p> 151 <p>It should be noted that early versions of BSD ignore any invalid options and accept a single <tt>'-'</tt> as an alternative to 152 <b>-i</b>. They also print a message if unable to open a file:</p> 153 <pre> 154 <tt>"tee: cannot access %s\n", <</tt><i>pathname</i><tt>> 155 </tt></pre> 156 <p>Historical implementations ignore write errors. This is explicitly not permitted by this volume of POSIX.1-2024.</p> 157 <p>Some historical implementations use O_APPEND when providing append mode; others use the <a href= 158 "../functions/lseek.html"><i>lseek</i>()</a> function to seek to the end-of-file after opening the file without O_APPEND. This 159 volume of POSIX.1-2024 requires functionality equivalent to using O_APPEND; see <a href= 160 "../utilities/V3_chap01.html#tag_18_01_01_04"><i>1.1.1.4 File Read, Write, and Creation</i></a> .</p> 161 </blockquote> 162 <h4 class="mansect"><a name="tag_20_120_19" id="tag_20_120_19"></a>FUTURE DIRECTIONS</h4> 163 <blockquote> 164 <p>If this utility is directed to create a new directory entry that contains any bytes that have the encoded value of a 165 <newline> character, implementations are encouraged to treat this as an error. A future version of this standard may require 166 implementations to treat this as an error.</p> 167 </blockquote> 168 <h4 class="mansect"><a name="tag_20_120_20" id="tag_20_120_20"></a>SEE ALSO</h4> 169 <blockquote> 170 <p><a href="../utilities/V3_chap01.html#tag_18"><i>1. Introduction</i></a> , <a href="../utilities/cat.html#"><i>cat</i></a></p> 171 <p>XBD <a href="../basedefs/V1_chap08.html#tag_08"><i>8. Environment Variables</i></a> , <a href= 172 "../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax Guidelines</i></a></p> 173 <p>XSH <a href="../functions/lseek.html#"><i>lseek</i></a></p> 174 </blockquote> 175 <h4 class="mansect"><a name="tag_20_120_21" id="tag_20_120_21"></a>CHANGE HISTORY</h4> 176 <blockquote> 177 <p>First released in Issue 2.</p> 178 </blockquote> 179 <h4 class="mansect"><a name="tag_20_120_22" id="tag_20_120_22"></a>Issue 6</h4> 180 <blockquote> 181 <p>IEEE PASC Interpretation 1003.2 #168 is applied.</p> 182 </blockquote> 183 <h4 class="mansect"><a name="tag_20_120_23" id="tag_20_120_23"></a>Issue 7</h4> 184 <blockquote> 185 <p>Austin Group Interpretation 1003.1-2001 #092 is applied.</p> 186 <p>SD5-XCU-ERN-97 is applied, updating the SYNOPSIS.</p> 187 </blockquote> 188 <h4 class="mansect"><a name="tag_20_120_24" id="tag_20_120_24"></a>Issue 8</h4> 189 <blockquote> 190 <p>Austin Group Defect 251 is applied, encouraging implementations to disallow the creation of filenames containing any bytes that 191 have the encoded value of a <newline> character.</p> 192 <p>Austin Group Defect 1122 is applied, changing the description of <i>NLSPATH .</i></p> 193 <p>Austin Group Defect 1494 is applied, inserting a missing closing parenthesis.</p> 194 </blockquote> 195 <div class="box"><em>End of informative text.</em></div> 196 <hr> 197 <p> </p> 198 <a href="#top"><span class="topOfPage">return to top of page</span></a><br> 199 <hr size="2" noshade> 200 <center><font size="2">UNIX® is a registered Trademark of The Open Group.<br> 201 POSIX™ is a Trademark of The IEEE.<br> 202 Copyright © 2001-2024 The IEEE and The Open Group, All Rights Reserved<br> 203 [ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href= 204 "../functions/contents.html">XSH</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../xrat/contents.html">XRAT</a> 205 ]</font></center> 206 <hr size="2" noshade> 207 <div class="NAVHEADER"> 208 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0"> 209 <tr class="nav"> 210 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/talk.html" accesskey="P"><<< 211 Previous</a></td> 212 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td> 213 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/test.html" accesskey="N">Next >>></a></td> 214 </tr> 215 </table> 216 <hr align="left" width="100%"></div> 217 </body> 218 </html>