Un outil pour savoir si une commande est posix - retour accueil
git clone git://bebou.netlib.re/isposix
Log | Files | Refs | README |
mkdir.html (13629B)
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>mkdir</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/mesg.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/mkfifo.html" accesskey="N">Next 19 >>></a></td> 20 </tr> 21 </table> 22 <hr align="left" width="100%"></div> 23 <script language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> 24 <center><font size="2">The Open Group Base Specifications Issue 8<br> 25 IEEE Std 1003.1-2024<br> 26 Copyright © 2001-2024 The IEEE and The Open Group</font></center> 27 <hr size="2" noshade> 28 <a name="top" id="top"></a> <a name="mkdir" id="mkdir"></a> <a name="tag_20_79" id="tag_20_79"></a><!-- mkdir --> 29 <h4 class="mansect"><a name="tag_20_79_01" id="tag_20_79_01"></a>NAME</h4> 30 <blockquote>mkdir — make directories</blockquote> 31 <h4 class="mansect"><a name="tag_20_79_02" id="tag_20_79_02"></a>SYNOPSIS</h4> 32 <blockquote class="synopsis"> 33 <p><code><tt>mkdir</tt> <b>[</b><tt>-p</tt><b>] [</b><tt>-m</tt> <i>mode</i><b>]</b> <i>dir</i><tt>...</tt></code></p> 34 </blockquote> 35 <h4 class="mansect"><a name="tag_20_79_03" id="tag_20_79_03"></a>DESCRIPTION</h4> 36 <blockquote> 37 <p>The <i>mkdir</i> utility shall create the directories specified by the operands, in the order specified.</p> 38 <p>For each <i>dir</i> operand, the <i>mkdir</i> utility shall perform actions equivalent to the <a href= 39 "../functions/mkdir.html"><i>mkdir</i>()</a> function defined in the System Interfaces volume of POSIX.1-2024, called with the 40 following arguments:</p> 41 <ol> 42 <li> 43 <p>The <i>dir</i> operand is used as the <i>path</i> argument.</p> 44 </li> 45 <li> 46 <p>The value of the bitwise-inclusive OR of S_IRWXU, S_IRWXG, and S_IRWXO is used as the <i>mode</i> argument. (If the <b>-m</b> 47 option is specified, the value of the <a href="../functions/mkdir.html"><i>mkdir</i>()</a> <i>mode</i> argument is unspecified, but 48 the directory shall at no time have permissions less restrictive than the <b>-m</b> <i>mode</i> option-argument.)</p> 49 </li> 50 </ol> 51 </blockquote> 52 <h4 class="mansect"><a name="tag_20_79_04" id="tag_20_79_04"></a>OPTIONS</h4> 53 <blockquote> 54 <p>The <i>mkdir</i> utility shall conform to XBD <a href="../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax 55 Guidelines</i></a> .</p> 56 <p>The following options shall be supported:</p> 57 <dl compact> 58 <dd></dd> 59 <dt><b>-m </b><i>mode</i></dt> 60 <dd>Set the file permission bits of the newly-created directory to the specified <i>mode</i> value. The <i>mode</i> option-argument 61 shall be the same as the <i>mode</i> operand defined for the <a href="../utilities/chmod.html"><i>chmod</i></a> utility. In the 62 <i>symbolic_mode</i> strings, the <i>op</i> characters <tt>'+'</tt> and <tt>'-'</tt> shall be interpreted relative to an assumed 63 initial mode of <i>a</i>=<i>rwx</i>; <tt>'+'</tt> shall add permissions to the default mode, <tt>'-'</tt> shall delete permissions 64 from the default mode.</dd> 65 <dt><b>-p</b></dt> 66 <dd>Create any missing intermediate pathname components. 67 <p>For each <i>dir</i> operand that does not name an existing directory, before performing the actions described in the DESCRIPTION 68 above, the <i>mkdir</i> utility shall create any pathname components of the path prefix of <i>dir</i> that do not name an existing 69 directory by performing actions equivalent to first calling the <a href="../functions/mkdir.html"><i>mkdir</i>()</a> function with 70 the following arguments:</p> 71 <ol> 72 <li> 73 <p>A pathname naming the missing pathname component, ending with a trailing <slash> character, as the <i>path</i> 74 argument</p> 75 </li> 76 <li> 77 <p>The value zero as the <i>mode</i> argument</p> 78 </li> 79 </ol> 80 <p>and then calling the <a href="../functions/chmod.html"><i>chmod</i>()</a> function with the following arguments:</p> 81 <ol> 82 <li> 83 <p>The same <i>path</i> argument as in the <a href="../functions/mkdir.html"><i>mkdir</i>()</a> call</p> 84 </li> 85 <li> 86 <p>The value <tt>(S_IWUSR|S_IXUSR|~<i>filemask</i>)&0777</tt> as the <i>mode</i> argument, where <i>filemask</i> is the file 87 mode creation mask of the process (see XSH <a href="../functions/umask.html#tag_17_645"><i>umask</i></a> )</p> 88 </li> 89 </ol> 90 <p>Each <i>dir</i> operand that names an existing directory shall be ignored without error.</p> 91 </dd> 92 </dl> 93 </blockquote> 94 <h4 class="mansect"><a name="tag_20_79_05" id="tag_20_79_05"></a>OPERANDS</h4> 95 <blockquote> 96 <p>The following operand shall be supported:</p> 97 <dl compact> 98 <dd></dd> 99 <dt><i>dir</i></dt> 100 <dd>A pathname of a directory to be created.</dd> 101 </dl> 102 </blockquote> 103 <h4 class="mansect"><a name="tag_20_79_06" id="tag_20_79_06"></a>STDIN</h4> 104 <blockquote> 105 <p>Not used.</p> 106 </blockquote> 107 <h4 class="mansect"><a name="tag_20_79_07" id="tag_20_79_07"></a>INPUT FILES</h4> 108 <blockquote> 109 <p>None.</p> 110 </blockquote> 111 <h4 class="mansect"><a name="tag_20_79_08" id="tag_20_79_08"></a>ENVIRONMENT VARIABLES</h4> 112 <blockquote> 113 <p>The following environment variables shall affect the execution of <i>mkdir</i>:</p> 114 <dl compact> 115 <dd></dd> 116 <dt><i>LANG</i></dt> 117 <dd>Provide a default value for the internationalization variables that are unset or null. (See XBD <a href= 118 "../basedefs/V1_chap08.html#tag_08_02"><i>8.2 Internationalization Variables</i></a> for the precedence of internationalization 119 variables used to determine the values of locale categories.)</dd> 120 <dt><i>LC_ALL</i></dt> 121 <dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd> 122 <dt><i>LC_CTYPE</i></dt> 123 <dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as 124 opposed to multi-byte characters in arguments).</dd> 125 <dt><i>LC_MESSAGES</i></dt> 126 <dd><br> 127 Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.</dd> 128 <dt><i>NLSPATH</i></dt> 129 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 130 Determine the location of messages objects and message catalogs. <img src="../images/opt-end.gif" alt="[Option End]" border= 131 "0"></dd> 132 </dl> 133 </blockquote> 134 <h4 class="mansect"><a name="tag_20_79_09" id="tag_20_79_09"></a>ASYNCHRONOUS EVENTS</h4> 135 <blockquote> 136 <p>Default.</p> 137 </blockquote> 138 <h4 class="mansect"><a name="tag_20_79_10" id="tag_20_79_10"></a>STDOUT</h4> 139 <blockquote> 140 <p>Not used.</p> 141 </blockquote> 142 <h4 class="mansect"><a name="tag_20_79_11" id="tag_20_79_11"></a>STDERR</h4> 143 <blockquote> 144 <p>The standard error shall be used only for diagnostic messages.</p> 145 </blockquote> 146 <h4 class="mansect"><a name="tag_20_79_12" id="tag_20_79_12"></a>OUTPUT FILES</h4> 147 <blockquote> 148 <p>None.</p> 149 </blockquote> 150 <h4 class="mansect"><a name="tag_20_79_13" id="tag_20_79_13"></a>EXTENDED DESCRIPTION</h4> 151 <blockquote> 152 <p>None.</p> 153 </blockquote> 154 <h4 class="mansect"><a name="tag_20_79_14" id="tag_20_79_14"></a>EXIT STATUS</h4> 155 <blockquote> 156 <p>The following exit values shall be returned:</p> 157 <dl compact> 158 <dd></dd> 159 <dt> 0</dt> 160 <dd>All the specified directories were created successfully, or the <b>-p</b> option was specified and all the specified 161 directories either already existed or were created successfully.</dd> 162 <dt>>0</dt> 163 <dd>An error occurred.</dd> 164 </dl> 165 </blockquote> 166 <h4 class="mansect"><a name="tag_20_79_15" id="tag_20_79_15"></a>CONSEQUENCES OF ERRORS</h4> 167 <blockquote> 168 <p>Default.</p> 169 </blockquote> 170 <hr> 171 <div class="box"><em>The following sections are informative.</em></div> 172 <h4 class="mansect"><a name="tag_20_79_16" id="tag_20_79_16"></a>APPLICATION USAGE</h4> 173 <blockquote> 174 <p>The default file mode for directories is <i>a</i>=<i>rwx</i> (777 on most systems) with selected permissions removed in 175 accordance with the file mode creation mask. For intermediate pathname components created by <i>mkdir</i>, the mode is the default 176 modified by <i>u</i>+<i>wx</i> so that the subdirectories can always be created regardless of the file mode creation mask; if 177 different ultimate permissions are desired for the intermediate directories, they can be changed afterwards with <a href= 178 "../utilities/chmod.html"><i>chmod</i></a>.</p> 179 <p>Note that some of the requested directories may have been created even if an error occurs.</p> 180 </blockquote> 181 <h4 class="mansect"><a name="tag_20_79_17" id="tag_20_79_17"></a>EXAMPLES</h4> 182 <blockquote> 183 <p>None.</p> 184 </blockquote> 185 <h4 class="mansect"><a name="tag_20_79_18" id="tag_20_79_18"></a>RATIONALE</h4> 186 <blockquote> 187 <p>The System V <b>-m</b> option was included to control the file mode.</p> 188 <p>The System V <b>-p</b> option was included to create any needed intermediate directories and to complement the functionality 189 provided by <a href="../utilities/rmdir.html"><i>rmdir</i></a> for removing directories in the path prefix as they become empty. 190 Because no error is produced if any path component already exists, the <b>-p</b> option is also useful to ensure that a particular 191 directory exists.</p> 192 <p>The functionality of <i>mkdir</i> is described substantially through a reference to the <a href= 193 "../functions/mkdir.html"><i>mkdir</i>()</a> function in the System Interfaces volume of POSIX.1-2024. For example, by default, the 194 mode of the directory is affected by the file mode creation mask in accordance with the specified behavior of the <a href= 195 "../functions/mkdir.html"><i>mkdir</i>()</a> function. In this way, there is less duplication of effort required for describing 196 details of the directory creation.</p> 197 </blockquote> 198 <h4 class="mansect"><a name="tag_20_79_19" id="tag_20_79_19"></a>FUTURE DIRECTIONS</h4> 199 <blockquote> 200 <p>If this utility is directed to create a new directory entry that contains any bytes that have the encoded value of a 201 <newline> character, implementations are encouraged to treat this as an error. A future version of this standard may require 202 implementations to treat this as an error.</p> 203 </blockquote> 204 <h4 class="mansect"><a name="tag_20_79_20" id="tag_20_79_20"></a>SEE ALSO</h4> 205 <blockquote> 206 <p><a href="../utilities/chmod.html#tag_20_17"><i>chmod</i></a> , <a href="../utilities/rm.html#"><i>rm</i></a> , <a href= 207 "../utilities/rmdir.html#tag_20_106"><i>rmdir</i></a> , <a href="../utilities/umask.html#tag_20_132"><i>umask</i></a></p> 208 <p>XBD <a href="../basedefs/V1_chap08.html#tag_08"><i>8. Environment Variables</i></a> , <a href= 209 "../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax Guidelines</i></a></p> 210 <p>XSH <a href="../functions/mkdir.html#tag_17_338"><i>mkdir</i></a> , <a href= 211 "../functions/umask.html#tag_17_645"><i>umask</i></a></p> 212 </blockquote> 213 <h4 class="mansect"><a name="tag_20_79_21" id="tag_20_79_21"></a>CHANGE HISTORY</h4> 214 <blockquote> 215 <p>First released in Issue 2.</p> 216 </blockquote> 217 <h4 class="mansect"><a name="tag_20_79_22" id="tag_20_79_22"></a>Issue 5</h4> 218 <blockquote> 219 <p>The FUTURE DIRECTIONS section is added.</p> 220 </blockquote> 221 <h4 class="mansect"><a name="tag_20_79_23" id="tag_20_79_23"></a>Issue 7</h4> 222 <blockquote> 223 <p>SD5-XCU-ERN-56 is applied, aligning the <b>-m</b> option with the IEEE P1003.2b draft standard to clarify an ambiguity.</p> 224 <p>SD5-XCU-ERN-97 is applied, updating the SYNOPSIS.</p> 225 <p>POSIX.1-2008, Technical Corrigendum 1, XCU/TC1-2008/0122 [161] is applied.</p> 226 <p>POSIX.1-2008, Technical Corrigendum 2, XCU/TC2-2008/0145 [843] is applied.</p> 227 </blockquote> 228 <h4 class="mansect"><a name="tag_20_79_24" id="tag_20_79_24"></a>Issue 8</h4> 229 <blockquote> 230 <p>Austin Group Defect 251 is applied, encouraging implementations to disallow the creation of filenames containing any bytes that 231 have the encoded value of a <newline> character.</p> 232 <p>Austin Group Defect 1122 is applied, changing the description of <i>NLSPATH .</i></p> 233 </blockquote> 234 <div class="box"><em>End of informative text.</em></div> 235 <hr> 236 <p> </p> 237 <a href="#top"><span class="topOfPage">return to top of page</span></a><br> 238 <hr size="2" noshade> 239 <center><font size="2">UNIX® is a registered Trademark of The Open Group.<br> 240 POSIX™ is a Trademark of The IEEE.<br> 241 Copyright © 2001-2024 The IEEE and The Open Group, All Rights Reserved<br> 242 [ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href= 243 "../functions/contents.html">XSH</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../xrat/contents.html">XRAT</a> 244 ]</font></center> 245 <hr size="2" noshade> 246 <div class="NAVHEADER"> 247 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0"> 248 <tr class="nav"> 249 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/mesg.html" accesskey="P"><<< 250 Previous</a></td> 251 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td> 252 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/mkfifo.html" accesskey="N">Next 253 >>></a></td> 254 </tr> 255 </table> 256 <hr align="left" width="100%"></div> 257 </body> 258 </html>