📄 mv.html
字号:
IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap08.html#tag_08_02">Section 8.2, Internationalization Variables</a> forthe precedence of internationalization variables used to determine the values of locale categories.)</dd><dt><i>LC_ALL</i></dt><dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd><dt><i>LC_COLLATE</i></dt><dd><br>Determine the locale for the behavior of ranges, equivalence classes, and multi-character collating elements used in the extendedregular expression defined for the <b>yesexpr</b> locale keyword in the <i>LC_MESSAGES</i> category.</dd><dt><i>LC_CTYPE</i></dt><dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte asopposed to multi-byte characters in arguments and input files), the behavior of character classes used in the extended regularexpression defined for the <b>yesexpr</b> locale keyword in the <i>LC_MESSAGES</i> category.</dd><dt><i>LC_MESSAGES</i></dt><dd>Determine the locale for the processing of affirmative responses that should be used to affect the format and contents ofdiagnostic messages written to standard error.</dd><dt><i>NLSPATH</i></dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">Determine the location of message catalogs for the processing of <i>LC_MESSAGES .</i> <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd></dl></blockquote><h4><a name="tag_04_90_09"></a>ASYNCHRONOUS EVENTS</h4><blockquote><p>Default.</p></blockquote><h4><a name="tag_04_90_10"></a>STDOUT</h4><blockquote><p>Not used.</p></blockquote><h4><a name="tag_04_90_11"></a>STDERR</h4><blockquote><p>Prompts shall be written to the standard error under the conditions specified in the DESCRIPTION section. The prompts shallcontain the destination pathname, but their format is otherwise unspecified. Otherwise, the standard error shall be used only fordiagnostic messages.</p></blockquote><h4><a name="tag_04_90_12"></a>OUTPUT FILES</h4><blockquote><p>The output files may be of any file type.</p></blockquote><h4><a name="tag_04_90_13"></a>EXTENDED DESCRIPTION</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_90_14"></a>EXIT STATUS</h4><blockquote><p>The following exit values shall be returned:</p><dl compact><dt> 0</dt><dd>All input files were moved successfully.</dd><dt>>0</dt><dd>An error occurred.</dd></dl></blockquote><h4><a name="tag_04_90_15"></a>CONSEQUENCES OF ERRORS</h4><blockquote><p>If the copying or removal of <i>source_file</i> is prematurely terminated by a signal or error, <i>mv</i> may leave a partialcopy of <i>source_file</i> at the source or destination. The <i>mv</i> utility shall not modify both <i>source_file</i> and thedestination path simultaneously; termination at any point shall leave either <i>source_file</i> or the destination pathcomplete.</p></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_04_90_16"></a>APPLICATION USAGE</h4><blockquote><p>Some implementations mark for update the <i>st_ctime</i> field of renamed files and some do not. Applications which make use ofthe <i>st_ctime</i> field may behave differently with respect to renamed files unless they are designed to allow for eitherbehavior.</p></blockquote><h4><a name="tag_04_90_17"></a>EXAMPLES</h4><blockquote><p>If the current directory contains only files <b>a</b> (of any type defined by the System Interfaces volume ofIEEE Std 1003.1-2001), <b>b</b> (also of any type), and a directory <b>c</b>:</p><pre><tt>mv a b cmv c d</tt></pre><p>results with the original files <b>a</b> and <b>b</b> residing in the directory <b>d</b> in the current directory.</p></blockquote><h4><a name="tag_04_90_18"></a>RATIONALE</h4><blockquote><p>Early proposals diverged from the SVID and BSD historical practice in that they required that when the destination path exists,the <b>-f</b> option is not specified, and input is not a terminal, <i>mv</i> fails. This was done for compatibility with <a href="../utilities/cp.html"><i>cp</i></a>. The current text returns to historical practice. It should be noted that this is consistentwith the <a href="../functions/rename.html"><i>rename</i>()</a> function defined in the System Interfaces volume ofIEEE Std 1003.1-2001, which does not require write permission on the target.</p><p>For absolute clarity, paragraph (1), describing the behavior of <i>mv</i> when prompting for confirmation, should be interpretedin the following manner:</p><pre><tt>if (exists AND (NOT f_option) AND ((not_writable AND input_is_terminal) OR i_option))</tt></pre><p>The <b>-i</b> option exists on BSD systems, giving applications and users a way to avoid accidentally unlinking files whenmoving others. When the standard input is not a terminal, the 4.3 BSD <i>mv</i> deletes all existing destination paths withoutprompting, even when <b>-i</b> is specified; this is inconsistent with the behavior of the 4.3 BSD <a href="../utilities/cp.html"><i>cp</i></a> utility, which always generates an error when the file is unwritable and the standard input isnot a terminal. The standard developers decided that use of <b>-i</b> is a request for interaction, so when the destination pathexists, the utility takes instructions from whatever responds to standard input.</p><p>The <a href="../functions/rename.html"><i>rename</i>()</a> function is able to move directories within the same file system.Some historical versions of <i>mv</i> have been able to move directories, but not to a different file system. The standarddevelopers considered that this was an annoying inconsistency, so this volume of IEEE Std 1003.1-2001 requiresdirectories to be able to be moved even across file systems. There is no <b>-R</b> option to confirm that moving a directory isactually intended, since such an option was not required for moving directories in historical practice. Requiring the applicationto specify it sometimes, depending on the destination, seemed just as inconsistent. The semantics of the <a href="../functions/rename.html"><i>rename</i>()</a> function were preserved as much as possible. For example, <i>mv</i> is not permittedto "rename" files to or from directories, even though they might be empty and removable.</p><p>Historic implementations of <i>mv</i> did not exit with a non-zero exit status if they were unable to duplicate any filecharacteristics when moving a file across file systems, nor did they write a diagnostic message for the user. The former behaviorhas been preserved to prevent scripts from breaking; a diagnostic message is now required, however, so that users are alerted thatthe file characteristics have changed.</p><p>The exact format of the interactive prompts is unspecified. Only the general nature of the contents of prompts are specifiedbecause implementations may desire more descriptive prompts than those used on historical implementations. Therefore, anapplication not using the <b>-f</b> option or using the <b>-i</b> option relies on the system to provide the most suitable dialogdirectly with the user, based on the behavior specified.</p><p>When <i>mv</i> is dealing with a single file system and <i>source_file</i> is a symbolic link, the link itself is moved as aconsequence of the dependence on the <a href="../functions/rename.html"><i>rename</i>()</a> functionality, per the DESCRIPTION.Across file systems, this has to be made explicit.</p></blockquote><h4><a name="tag_04_90_19"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_90_20"></a>SEE ALSO</h4><blockquote><p><a href="cp.html"><i>cp</i></a> , <a href="ln.html"><i>ln</i></a> , the System Interfaces volume ofIEEE Std 1003.1-2001, <a href="../functions/rename.html"><i>rename</i>()</a></p></blockquote><h4><a name="tag_04_90_21"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 2.</p></blockquote><h4><a name="tag_04_90_22"></a>Issue 6</h4><blockquote><p>The <i>mv</i> utility is changed to describe processing of symbolic links as specified in the IEEE P1003.2b draftstandard.</p><p>The APPLICATION USAGE section is added.</p></blockquote><div class="box"><em>End of informative text.</em></div><hr><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX ® is a registered Trademark of The Open Group.<br>POSIX ® is a registered Trademark of The IEEE.<br>[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>]</font></center><!--footer end--><hr size="2" noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -