📄 rm.html
字号:
<!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>rm</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="rm"></a> <a name="tag_04_121"></a><!-- rm --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright © 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_04_121_01"></a>NAME</h4><blockquote>rm - remove directory entries</blockquote><h4><a name="tag_04_121_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><p><code><tt>rm</tt> <b>[</b><tt>-fiRr</tt><b>]</b> <i>file</i><tt>...</tt></code></p></blockquote><h4><a name="tag_04_121_03"></a>DESCRIPTION</h4><blockquote><p>The <i>rm</i> utility shall remove the directory entry specified by each <i>file</i> argument.</p><p>If either of the files dot or dot-dot are specified as the basename portion of an operand (that is, the final pathnamecomponent), <i>rm</i> shall write a diagnostic message to standard error and do nothing more with such operands.</p><p>For each <i>file</i> the following steps shall be taken:</p><ol><li><p>If the <i>file</i> does not exist:</p><ol type="a"><li><p>If the <b>-f</b> option is not specified, <i>rm</i> shall write a diagnostic message to standard error.</p></li><li><p>Go on to any remaining <i>files</i>.</p></li></ol></li><li><p>If <i>file</i> is of type directory, the following steps shall be taken:</p><ol type="a"><li><p>If neither the <b>-R</b> option nor the <b>-r</b> option is specified, <i>rm</i> shall write a diagnostic message to standarderror, do nothing more with <i>file</i>, and go on to any remaining files.</p></li><li><p>If the <b>-f</b> option is not specified, and either the permissions of <i>file</i> do not permit writing and the standard inputis a terminal or the <b>-i</b> option is specified, <i>rm</i> shall write a prompt to standard error and read a line from thestandard input. If the response is not affirmative, <i>rm</i> shall do nothing more with the current file and go on to anyremaining files.</p></li><li><p>For each entry contained in <i>file</i>, other than dot or dot-dot, the four steps listed here (1 to 4) shall be taken with theentry as if it were a <i>file</i> operand. The <i>rm</i> utility shall not traverse directories by following symbolic links intoother parts of the hierarchy, but shall remove the links themselves.</p></li><li><p>If the <b>-i</b> option is specified, <i>rm</i> shall write a prompt to standard error and read a line from the standard input.If the response is not affirmative, <i>rm</i> shall do nothing more with the current file, and go on to any remaining files.</p></li></ol></li><li><p>If <i>file</i> is not of type directory, the <b>-f</b> option is not specified, and either the permissions of <i>file</i> do notpermit writing and the standard input is a terminal or the <b>-i</b> option is specified, <i>rm</i> shall write a prompt to thestandard error and read a line from the standard input. If the response is not affirmative, <i>rm</i> shall do nothing more withthe current file and go on to any remaining files.</p></li><li><p>If the current file is a directory, <i>rm</i> shall perform actions equivalent to the <a href="../functions/rmdir.html"><i>rmdir</i>()</a> function defined in the System Interfaces volume of IEEE Std 1003.1-2001called with a pathname of the current file used as the <i>path</i> argument. If the current file is not a directory, <i>rm</i>shall perform actions equivalent to the <a href="../functions/unlink.html"><i>unlink</i>()</a> function defined in the SystemInterfaces volume of IEEE Std 1003.1-2001 called with a pathname of the current file used as the <i>path</i>argument.</p><p>If this fails for any reason, <i>rm</i> shall write a diagnostic message to standard error, do nothing more with the currentfile, and go on to any remaining files.</p></li></ol><p>The <i>rm</i> utility shall be able to descend to arbitrary depths in a file hierarchy, and shall not fail due to path lengthlimitations (unless an operand specified by the user exceeds system limitations).</p></blockquote><h4><a name="tag_04_121_04"></a>OPTIONS</h4><blockquote><p>The <i>rm</i> utility shall conform to the Base Definitions volume of IEEE Std 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. Do not write diagnostic messages or modify the exit status in the case of nonexistent operands.Any previous occurrences of the <b>-i</b> option shall be ignored.</dd><dt><b>-i</b></dt><dd>Prompt for confirmation as described previously. Any previous occurrences of the <b>-f</b> option shall be ignored.</dd><dt><b>-R</b></dt><dd>Remove file hierarchies. See the DESCRIPTION.</dd><dt><b>-r</b></dt><dd>Equivalent to <b>-R</b>.</dd></dl></blockquote><h4><a name="tag_04_121_05"></a>OPERANDS</h4><blockquote><p>The following operand shall be supported:</p><dl compact><dt><i>file</i></dt><dd>A pathname of a directory entry to be removed.</dd></dl></blockquote><h4><a name="tag_04_121_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 STDOUT section. Otherwise,the standard input shall not be used.</p></blockquote><h4><a name="tag_04_121_07"></a>INPUT FILES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_121_08"></a>ENVIRONMENT VARIABLES</h4><blockquote><p>The following environment variables shall affect the execution of <i>rm</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 ofIEEE 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 the behavior of character classes within regular expressions used in theextended regular expression 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_121_09"></a>ASYNCHRONOUS EVENTS</h4>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -