⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mv.html

📁 IEEE 1003.1-2003, Single Unix Specification v3
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy, see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 --><!-- Copyright (c) 2001-2003 The Open Group, All Rights Reserved --><title>mv</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="mv"></a> <a name="tag_04_90"></a><!-- mv --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright &copy; 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_04_90_01"></a>NAME</h4><blockquote>mv - move files</blockquote><h4><a name="tag_04_90_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><p><code><tt>mv</tt> <b>[</b><tt>-fi</tt><b>]</b> <i>source_file target_file</i><tt><br><br>mv</tt> <b>[</b><tt>-fi</tt><b>]</b> <i>source_file</i><tt>...</tt> <i>target_file</i><tt><br></tt></code></p></blockquote><h4><a name="tag_04_90_03"></a>DESCRIPTION</h4><blockquote><p>In the first synopsis form, the <i>mv</i> utility shall move the file named by the <i>source_file</i> operand to the destinationspecified by the <i>target_file</i>. This first synopsis form is assumed when the final operand does not name an existing directoryand is not a symbolic link referring to an existing directory.</p><p>In the second synopsis form, <i>mv</i> shall move each file named by a <i>source_file</i> operand to a destination file in theexisting directory named by the <i>target_dir</i> operand, or referenced if <i>target_dir</i> is a symbolic link referring to anexisting directory. The destination path for each <i>source_file</i> shall be the concatenation of the target directory, a singleslash character, and the last pathname component of the <i>source_file</i>. This second form is assumed when the final operandnames an existing directory.</p><p>If any operand specifies an existing file of a type not specified by the System Interfaces volume ofIEEE&nbsp;Std&nbsp;1003.1-2001, the behavior is implementation-defined.</p><p>For each <i>source_file</i> the following steps shall be taken:</p><ol><li><p>If the destination path exists, the <b>-f</b> option is not specified, and either of the following conditions is true:</p><ol type="a"><li><p>The permissions of the destination path do not permit writing and the standard input is a terminal.</p></li><li><p>The <b>-i</b> option is specified.</p></li></ol><p>the <i>mv</i> utility shall write a prompt to standard error and read a line from standard input. If the response is notaffirmative, <i>mv</i> shall do nothing more with the current <i>source_file</i> and go on to any remaining<i>source_file</i>s.</p></li><li><p>The <i>mv</i> utility shall perform actions equivalent to the <a href="../functions/rename.html"><i>rename</i>()</a> functiondefined in the System Interfaces volume of IEEE&nbsp;Std&nbsp;1003.1-2001, called with the following arguments:</p><ol type="a"><li><p>The <i>source_file</i> operand is used as the <i>old</i> argument.</p></li><li><p>The destination path is used as the <i>new</i> argument.</p></li></ol><p>If this succeeds, <i>mv</i> shall do nothing more with the current <i>source_file</i> and go on to any remaining<i>source_file</i>s. If this fails for any reasons other than those described for the <i>errno</i> [EXDEV] in the System Interfacesvolume of IEEE&nbsp;Std&nbsp;1003.1-2001, <i>mv</i> shall write a diagnostic message to standard error, do nothing more with thecurrent <i>source_file</i>, and go on to any remaining <i>source_file</i>s.</p></li><li><p>If the destination path exists, and it is a file of type directory and <i>source_file</i> is not a file of type directory, or itis a file not of type directory and <i>source_file</i> is a file of type directory, <i>mv</i> shall write a diagnostic message tostandard error, do nothing more with the current <i>source_file</i>, and go on to any remaining <i>source_file</i>s.</p></li><li><p>If the destination path exists, <i>mv</i> shall attempt to remove it. If this fails for any reason, <i>mv</i> shall write adiagnostic message to standard error, do nothing more with the current <i>source_file</i>, and go on to any remaining<i>source_file</i>s.</p></li><li><p>The file hierarchy rooted in <i>source_file</i> shall be duplicated as a file hierarchy rooted in the destination path. If<i>source_file</i> or any of the files below it in the hierarchy are symbolic links, the links themselves shall be duplicated,including their contents, rather than any files to which they refer. The following characteristics of each file in the filehierarchy shall be duplicated:</p><ul><li><p>The time of last data modification and time of last access</p></li><li><p>The user ID and group ID</p></li><li><p>The file mode</p></li></ul><p>If the user ID, group ID, or file mode of a regular file cannot be duplicated, the file mode bits S_ISUID and S_ISGID shall notbe duplicated.</p><p>When files are duplicated to another file system, the implementation may require that the process invoking <i>mv</i> has readaccess to each file being duplicated.</p><p>If the duplication of the file hierarchy fails for any reason, <i>mv</i> shall write a diagnostic message to standard error, donothing more with the current <i>source_file</i>, and go on to any remaining <i>source_file</i>s.</p><p>If the duplication of the file characteristics fails for any reason, <i>mv</i> shall write a diagnostic message to standarderror, but this failure shall not cause <i>mv</i> to modify its exit status.</p></li><li><p>The file hierarchy rooted in <i>source_file</i> shall be removed. If this fails for any reason, <i>mv</i> shall write adiagnostic message to the standard error, do nothing more with the current <i>source_file</i>, and go on to any remaining<i>source_file</i>s.</p></li></ol></blockquote><h4><a name="tag_04_90_04"></a>OPTIONS</h4><blockquote><p>The <i>mv</i> utility shall conform to the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/xbd_chap12.html#tag_12_02">Section 12.2, Utility Syntax Guidelines</a>.</p><p>The following options shall be supported:</p><dl compact><dt><b>-f</b></dt><dd>Do not prompt for confirmation if the destination path exists. Any previous occurrence of the <b>-i</b> option is ignored.</dd><dt><b>-i</b></dt><dd>Prompt for confirmation if the destination path exists. Any previous occurrence of the <b>-f</b> option is ignored.</dd></dl><p>Specifying more than one of the <b>-f</b> or <b>-i</b> options shall not be considered an error. The last option specified shalldetermine the behavior of <i>mv</i>.</p></blockquote><h4><a name="tag_04_90_05"></a>OPERANDS</h4><blockquote><p>The following operands shall be supported:</p><dl compact><dt><i>source_file</i></dt><dd>A pathname of a file or directory to be moved.</dd><dt><i>target_file</i></dt><dd>A new pathname for the file or directory being moved.</dd><dt><i>target_dir</i></dt><dd>A pathname of an existing directory into which to move the input files.</dd></dl></blockquote><h4><a name="tag_04_90_06"></a>STDIN</h4><blockquote><p>The standard input shall be used to read an input line in response to each prompt specified in the STDERR section. Otherwise,the standard input shall not be used.</p></blockquote><h4><a name="tag_04_90_07"></a>INPUT FILES</h4><blockquote><p>The input files specified by each <i>source_file</i> operand can be of any file type.</p></blockquote><h4><a name="tag_04_90_08"></a>ENVIRONMENT VARIABLES</h4><blockquote><p>The following environment variables shall affect the execution of <i>mv</i>:</p><dl compact><dt><i>LANG</i></dt><dd>Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -