isposix

Un outil pour savoir si une commande est posix - retour accueil

git clone git://bebou.netlib.re/isposix
Log | Files | Refs | README |

pwd.html (12324B)


      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>pwd</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/ps.html" accesskey="P">&lt;&lt;&lt;
     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/read.html" accesskey="N">Next &gt;&gt;&gt;</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="pwd" id="pwd"></a> <a name="tag_20_99" id="tag_20_99"></a><!-- pwd -->
     28 <h4 class="mansect"><a name="tag_20_99_01" id="tag_20_99_01"></a>NAME</h4>
     29 <blockquote>pwd — return working directory name</blockquote>
     30 <h4 class="mansect"><a name="tag_20_99_02" id="tag_20_99_02"></a>SYNOPSIS</h4>
     31 <blockquote class="synopsis">
     32 <p><code><tt>pwd</tt> <b>[</b><tt>-L|-P</tt><b>]</b></code></p>
     33 </blockquote>
     34 <h4 class="mansect"><a name="tag_20_99_03" id="tag_20_99_03"></a>DESCRIPTION</h4>
     35 <blockquote>
     36 <p>The <i>pwd</i> utility shall write to standard output an absolute pathname of the current working directory, which does not
     37 contain the filenames dot or dot-dot.</p>
     38 </blockquote>
     39 <h4 class="mansect"><a name="tag_20_99_04" id="tag_20_99_04"></a>OPTIONS</h4>
     40 <blockquote>
     41 <p>The <i>pwd</i> utility shall conform to XBD <a href="../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax
     42 Guidelines</i></a> .</p>
     43 <p>The following options shall be supported by the implementation:</p>
     44 <dl compact>
     45 <dd></dd>
     46 <dt><b>-L</b></dt>
     47 <dd>If the <i>PWD</i> environment variable contains an absolute pathname of the current directory and the pathname does not contain
     48 any components that are dot or dot-dot, <i>pwd</i> shall write this pathname to standard output, except that if the <i>PWD</i>
     49 environment variable is longer than {PATH_MAX} bytes including the terminating null, it is unspecified whether <i>pwd</i> writes
     50 this pathname to standard output or behaves as if the <b>-P</b> option had been specified. Otherwise, the <b>-L</b> option shall
     51 behave as the <b>-P</b> option.</dd>
     52 <dt><b>-P</b></dt>
     53 <dd>The pathname written to standard output shall not contain any components that refer to files of type symbolic link. If there
     54 are multiple pathnames that the <i>pwd</i> utility could write to standard output, one beginning with a single &lt;slash&gt;
     55 character and one or more beginning with two &lt;slash&gt; characters, then it shall write the pathname beginning with a single
     56 &lt;slash&gt; character. The pathname shall not contain any unnecessary &lt;slash&gt; characters after the leading one or two
     57 &lt;slash&gt; characters.</dd>
     58 </dl>
     59 <p>If both <b>-L</b> and <b>-P</b> are specified, the last one shall apply. If neither <b>-L</b> nor <b>-P</b> is specified, the
     60 <i>pwd</i> utility shall behave as if <b>-L</b> had been specified.</p>
     61 </blockquote>
     62 <h4 class="mansect"><a name="tag_20_99_05" id="tag_20_99_05"></a>OPERANDS</h4>
     63 <blockquote>
     64 <p>None.</p>
     65 </blockquote>
     66 <h4 class="mansect"><a name="tag_20_99_06" id="tag_20_99_06"></a>STDIN</h4>
     67 <blockquote>
     68 <p>Not used.</p>
     69 </blockquote>
     70 <h4 class="mansect"><a name="tag_20_99_07" id="tag_20_99_07"></a>INPUT FILES</h4>
     71 <blockquote>
     72 <p>None.</p>
     73 </blockquote>
     74 <h4 class="mansect"><a name="tag_20_99_08" id="tag_20_99_08"></a>ENVIRONMENT VARIABLES</h4>
     75 <blockquote>
     76 <p>The following environment variables shall affect the execution of <i>pwd</i>:</p>
     77 <dl compact>
     78 <dd></dd>
     79 <dt><i>LANG</i></dt>
     80 <dd>Provide a default value for the internationalization variables that are unset or null. (See XBD <a href=
     81 "../basedefs/V1_chap08.html#tag_08_02"><i>8.2 Internationalization Variables</i></a> the precedence of internationalization
     82 variables used to determine the values of locale categories.)</dd>
     83 <dt><i>LC_ALL</i></dt>
     84 <dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd>
     85 <dt><i>LC_MESSAGES</i></dt>
     86 <dd><br>
     87 Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.</dd>
     88 <dt><i>NLSPATH</i></dt>
     89 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
     90 Determine the location of messages objects and message catalogs. <img src="../images/opt-end.gif" alt="[Option End]" border=
     91 "0"></dd>
     92 <dt><i>PWD</i></dt>
     93 <dd>An absolute pathname of the current working directory. If an application sets or unsets the value of <i>PWD ,</i> the behavior
     94 of <i>pwd</i> is unspecified.</dd>
     95 </dl>
     96 </blockquote>
     97 <h4 class="mansect"><a name="tag_20_99_09" id="tag_20_99_09"></a>ASYNCHRONOUS EVENTS</h4>
     98 <blockquote>
     99 <p>Default.</p>
    100 </blockquote>
    101 <h4 class="mansect"><a name="tag_20_99_10" id="tag_20_99_10"></a>STDOUT</h4>
    102 <blockquote>
    103 <p>The <i>pwd</i> utility output is an absolute pathname of the current working directory:</p>
    104 <pre>
    105 <tt>"%s\n", &lt;</tt><i>directory pathname</i><tt>&gt;
    106 </tt></pre></blockquote>
    107 <h4 class="mansect"><a name="tag_20_99_11" id="tag_20_99_11"></a>STDERR</h4>
    108 <blockquote>
    109 <p>The standard error shall be used only for diagnostic messages.</p>
    110 </blockquote>
    111 <h4 class="mansect"><a name="tag_20_99_12" id="tag_20_99_12"></a>OUTPUT FILES</h4>
    112 <blockquote>
    113 <p>None.</p>
    114 </blockquote>
    115 <h4 class="mansect"><a name="tag_20_99_13" id="tag_20_99_13"></a>EXTENDED DESCRIPTION</h4>
    116 <blockquote>
    117 <p>None.</p>
    118 </blockquote>
    119 <h4 class="mansect"><a name="tag_20_99_14" id="tag_20_99_14"></a>EXIT STATUS</h4>
    120 <blockquote>
    121 <p>The following exit values shall be returned:</p>
    122 <dl compact>
    123 <dd></dd>
    124 <dt>&nbsp;0</dt>
    125 <dd>Successful completion.</dd>
    126 <dt>&gt;0</dt>
    127 <dd>An error occurred.</dd>
    128 </dl>
    129 </blockquote>
    130 <h4 class="mansect"><a name="tag_20_99_15" id="tag_20_99_15"></a>CONSEQUENCES OF ERRORS</h4>
    131 <blockquote>
    132 <p>If an error is detected other than a write error when writing to standard output, no output shall be written to standard output,
    133 a diagnostic message shall be written to standard error, and the exit status shall be non-zero.</p>
    134 </blockquote>
    135 <hr>
    136 <div class="box"><em>The following sections are informative.</em></div>
    137 <h4 class="mansect"><a name="tag_20_99_16" id="tag_20_99_16"></a>APPLICATION USAGE</h4>
    138 <blockquote>
    139 <p>If the pathname obtained from <i>pwd</i> is longer than {PATH_MAX} bytes, it could produce an error if passed to <a href=
    140 "../utilities/cd.html"><i>cd</i></a>. Therefore, in order to return to that directory it may be necessary to break the pathname
    141 into sections shorter than {PATH_MAX} and call <a href="../utilities/cd.html"><i>cd</i></a> on each section in turn (the first
    142 section being an absolute pathname and subsequent sections being relative pathnames).</p>
    143 </blockquote>
    144 <h4 class="mansect"><a name="tag_20_99_17" id="tag_20_99_17"></a>EXAMPLES</h4>
    145 <blockquote>
    146 <p>None.</p>
    147 </blockquote>
    148 <h4 class="mansect"><a name="tag_20_99_18" id="tag_20_99_18"></a>RATIONALE</h4>
    149 <blockquote>
    150 <p>Some implementations have historically provided <i>pwd</i> as a shell special built-in command.</p>
    151 <p>In most utilities, if an error occurs, partial output may be written to standard output. This does not happen in historical
    152 implementations of <i>pwd</i> (unless an error condition causes a partial write). Because <i>pwd</i> is frequently used in
    153 historical shell scripts without checking the exit status, it is important that the historical behavior is required here;
    154 therefore, the CONSEQUENCES OF ERRORS section specifically disallows any partial output being written to standard output, except
    155 when a write error occurs when writing to standard output.</p>
    156 <p>An earlier version of this standard stated that the <i>PWD</i> environment variable was affected when the <b>-P</b> option was
    157 in effect. This was incorrect; conforming implementations do not do this.</p>
    158 </blockquote>
    159 <h4 class="mansect"><a name="tag_20_99_19" id="tag_20_99_19"></a>FUTURE DIRECTIONS</h4>
    160 <blockquote>
    161 <p>If this utility is directed to display a pathname that contains any bytes that have the encoded value of a &lt;newline&gt;
    162 character when &lt;newline&gt; is a terminator or separator in the output format being used, implementations are encouraged to
    163 treat this as an error. A future version of this standard may require implementations to treat this as an error.</p>
    164 </blockquote>
    165 <h4 class="mansect"><a name="tag_20_99_20" id="tag_20_99_20"></a>SEE ALSO</h4>
    166 <blockquote>
    167 <p><a href="../utilities/cd.html#"><i>cd</i></a></p>
    168 <p>XBD <a href="../basedefs/V1_chap08.html#tag_08"><i>8. Environment Variables</i></a> , <a href=
    169 "../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax Guidelines</i></a></p>
    170 <p>XSH <a href="../functions/getcwd.html#"><i>getcwd</i></a></p>
    171 </blockquote>
    172 <h4 class="mansect"><a name="tag_20_99_21" id="tag_20_99_21"></a>CHANGE HISTORY</h4>
    173 <blockquote>
    174 <p>First released in Issue 2.</p>
    175 </blockquote>
    176 <h4 class="mansect"><a name="tag_20_99_22" id="tag_20_99_22"></a>Issue 6</h4>
    177 <blockquote>
    178 <p>The <b>-P</b> and <b>-L</b> options are added to describe actions relating to symbolic links as specified in the
    179 IEEE&nbsp;P1003.2b draft standard.</p>
    180 </blockquote>
    181 <h4 class="mansect"><a name="tag_20_99_23" id="tag_20_99_23"></a>Issue 7</h4>
    182 <blockquote>
    183 <p>Austin Group Interpretation 1003.1-2001 #097 is applied.</p>
    184 <p>SD5-XCU-ERN-97 is applied, updating the SYNOPSIS.</p>
    185 <p>Changes to the <i>pwd</i> utility and <i>PWD</i> environment variable have been made to match the changes to the <a href=
    186 "../functions/getcwd.html"><i>getcwd</i>()</a> function made for Austin Group Interpretation 1003.1-2001 #140.</p>
    187 <p>POSIX.1-2008, Technical Corrigendum 2, XCU/TC2-2008/0161 [471] is applied.</p>
    188 </blockquote>
    189 <h4 class="mansect"><a name="tag_20_99_24" id="tag_20_99_24"></a>Issue 8</h4>
    190 <blockquote>
    191 <p>Austin Group Defect 251 is applied, encouraging implementations to report an error if a utility is directed to display a
    192 pathname that contains any bytes that have the encoded value of a &lt;newline&gt; character when &lt;newline&gt; is a terminator or
    193 separator in the output format being used.</p>
    194 <p>Austin Group Defect 1122 is applied, changing the description of <i>NLSPATH .</i></p>
    195 <p>Austin Group Defect 1488 is applied, clarifying the behavior when a write error occurs when writing to standard output.</p>
    196 </blockquote>
    197 <div class="box"><em>End of informative text.</em></div>
    198 <hr>
    199 <p>&nbsp;</p>
    200 <a href="#top"><span class="topOfPage">return to top of page</span></a><br>
    201 <hr size="2" noshade>
    202 <center><font size="2">UNIX® is a registered Trademark of The Open Group.<br>
    203 POSIX™ is a Trademark of The IEEE.<br>
    204 Copyright © 2001-2024 The IEEE and The Open Group, All Rights Reserved<br>
    205 [ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
    206 "../functions/contents.html">XSH</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../xrat/contents.html">XRAT</a>
    207 ]</font></center>
    208 <hr size="2" noshade>
    209 <div class="NAVHEADER">
    210 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0">
    211 <tr class="nav">
    212 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/ps.html" accesskey="P">&lt;&lt;&lt;
    213 Previous</a></td>
    214 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td>
    215 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/read.html" accesskey="N">Next &gt;&gt;&gt;</a></td>
    216 </tr>
    217 </table>
    218 <hr align="left" width="100%"></div>
    219 </body>
    220 </html>