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

📄 find.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
📖 第 1 页 / 共 2 页
字号:
by writing to standard error as described in the STDERR section.If the response on standard input is affirmative,the utility will be invoked.Otherwise, the command will not be invokedand the value of the<b>-ok</b>operand will be false.<dt><b>-print</b><dd>The primary always will evaluate as true; it will causethe current pathname to be written to standard output.<dt><b>-newer&nbsp;</b><i>file</i><dd>The primary will evaluate as trueif the modification time of the current fileis more recent than the modification time of thefile named by the pathname<i>file</i>.<dt><b>-depth</b><dd>The primary always will evaluate as true; it will causedescent of the directory hierarchy to be doneso that all entries in a directory are acted onbefore the directory itself.If a<b>-depth</b>primary is not specified, all entries in a directorywill be acted on after the directory itself.If any<b>-depth</b>primaryis specified, it will apply to the entire expression even if the<b>-depth</b>primary would not normally be evaluated.</dl><p>The primaries can be combined using the following operators(in order of decreasing precedence):<dl compact><dt>(<dd>True if<i>expression</i>is true.<dt><b>! </b><i>expression</i><dd>Negation of a primary; the unary NOT operator.<dt><i>expression&nbsp;</i><b>[-a]&nbsp;</b><i>expression</i><dd>Conjunction of primaries; the ANDoperator will be implied by the juxtapositionof two primaries or made explicit by the optional<b>-a</b>operator.The second expression will not be evaluated if the firstexpression is false.<dt><i>expression </i><b>-o </b><i>expression</i><dd>Alternation of primaries; the OR operator.The second expression will not be evaluated ifthe first expression is true.</dl><p>If no<i>expression</i>is present,<b>-print</b>will be used as the expression.Otherwise, if the given expression does not containany of the primaries<b>-exec</b>,<b>-ok</b>or<b>-print</b>,the given expression will be effectively replaced by:<pre><code>( <i>given_expression</i> ) -print</code></pre><p>The<b>-user</b>,<b>-group</b>and<b>-newer</b>primaries each will evaluate their respective arguments only once.</blockquote><h4><a name = "tag_001_014_743">&nbsp;</a>STDIN</h4><blockquote>If the<b>-ok</b>primary is used, the response will be read from the standard input.An entire line will be read as the response.Otherwise, the standard input will not be used.</blockquote><h4><a name = "tag_001_014_744">&nbsp;</a>INPUT FILES</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_745">&nbsp;</a>ENVIRONMENT VARIABLES</h4><blockquote>The following environment variables affect the execution of<i>find</i>:<dl compact><dt><i>LANG</i><dd>Provide a default value for the internationalisation variablesthat are unset or null.If<i>LANG</i>is unset or null, the corresponding value from theimplementation-dependent default locale will be used.If any of the internationalisation variables contains an invalid setting, theutility will behave as if none of the variables had been defined.<dt><i>LC_ALL</i><dd>If set to a non-empty string value,override the values of all the other internationalisation variables.<dt><i>LC_COLLATE</i><dd>Determine the locale for thebehaviour of ranges, equivalence classesand multi-character collating elementsused in the pattern matching notation for the<b>-n</b>option and in the extended regular expression defined for the<b>yesexpr</b>locale keyword in the LC_MESSAGES category.<dt><i>LC_CTYPE</i><dd>This variable will determine thelocale for the interpretation of sequences of bytes of text data ascharacters (for example, single-versus multi-byte characters in arguments),the behaviour of character classes withinthe pattern matching notation used for the<b>-n</b>option,and the behaviour of character classes withinregular expressionsused in the extended regular expression defined for the<b>yesexpr</b>locale keyword in the LC_MESSAGES category.<dt><i>LC_MESSAGES</i><dd>Determine the locale for the processing of affirmative responsesthat should be used to affect the format and contents of diagnosticmessages written to standard error.<dt><i>NLSPATH</i><dd>Determine the location of message cataloguesfor the processing of<i>LC_MESSAGES .</i><dt><i>PATH</i><dd>Determine the location of the<i>utility_name</i>for the<b>-exec</b>and<b>-ok</b>primaries, as described inthe <b>XBD</b> specification, <a href="../xbd/envvar.html"><b>Environment Variables</b>&nbsp;</a> .</dl></blockquote><h4><a name = "tag_001_014_746">&nbsp;</a>ASYNCHRONOUS EVENTS</h4><blockquote>Default.</blockquote><h4><a name = "tag_001_014_747">&nbsp;</a>STDOUT</h4><blockquote>The<b>-print</b>primary will cause the current pathnames to be written to standard output.The format will be:<p><code><tt>"%s\n"</tt>, &lt;<i>path</i>&gt;</code></blockquote><h4><a name = "tag_001_014_748">&nbsp;</a>STDERR</h4><blockquote>The<b>-ok</b>primarywill write a prompt to standard error containing at least the<i>utility_name</i>to be invoked and the current pathname.In the POSIX locale, the lastnon-blank character in the prompt will be"?".The exact format used is unspecified.<p>Otherwise, the standard error will be used only for diagnostic messages.</blockquote><h4><a name = "tag_001_014_749">&nbsp;</a>OUTPUT FILES</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_750">&nbsp;</a>EXTENDED DESCRIPTION</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_751">&nbsp;</a>EXIT STATUS</h4><blockquote>The following exit values are returned:<dl compact><dt>0<dd>All<i>path</i>operands were traversed successfully.<dt>&gt;0<dd>An error occurred.</dl></blockquote><h4><a name = "tag_001_014_752">&nbsp;</a>CONSEQUENCES OF ERRORS</h4><blockquote>Default.</blockquote><h4><a name = "tag_001_014_753">&nbsp;</a>APPLICATION USAGE</h4><blockquote>When used in operands,pattern matching notation,semicolons, opening parentheses, and closing parentheses arespecial to the shell and must be quoted (see<a href="chap2.html#tag_001_002">Quoting</a>).<p>The bit that is traditionally used for sticky (historically 01000)is still specified in the<b>-perm</b>primary using the octal number argument form.Since this bit is not defined by this specification,applications must not assume that it actually refersto the traditional sticky bit.<p>The references to octal modes are marked EXbecause, although they are obsolescent in the ISO/IEC 9945-2:1993 standard,The Open Group is committed to maintaining themfor portable applications until further notice.</blockquote><h4><a name = "tag_001_014_754">&nbsp;</a>EXAMPLES</h4><blockquote><ol><li>The following commands are equivalent:<pre><code>find .find . -print</code></pre>They both write out the entire directory hierarchy from the current directory.<p><li>The following command:<pre><code>find / \( -name tmp -o -name '*.xx' \) -atime +7 -exec rm {} \;</code></pre>removes all files named<b>tmp</b>or ending in.xxthat have not been accessed for sevenor more 24-hour periods.<p><li>The following command:<pre><code>find . -perm -o+w,+s</code></pre>prints(<b>-print</b>is assumed) the names of all files in or below thecurrent directory, with all of the file permission bitsS_ISUID, S_ISGID and S_IWOTH set.<p><li>The following command:<pre><code>find . -name SCCS -prune -o -print</code></pre>recursively prints pathnames of all files in the currentdirectory and below, but skips directories named SCCS andfiles in them.<p><li>The following command:<pre><code>find . -print -name SCCS -prune</code></pre>behaves as in the previous example, but prints the names of theSCCS directories.<br><p><li>The following command is roughly equivalent to the<b>-nt</b>extension to<i><a href="test.html">test</a></i>:<pre><code>if [ -n "$(find file1 -prune -newer file2)" ]; then    printf %s\\n "file1 is newer than file2"fi</code></pre><p><li>The descriptions of<b>-atime</b>,<b>-ctime</b>and<b>-mtime</b>use the terminology<i>n</i>&quot;24-hour periods&quot;.For example, a file accessed at23:59 will be selected by:<pre><code>find . -atime -1 -print</code></pre>at 00:01 the next day (less than 24 hours later, notmore than one day ago); the midnight boundary betweendays has no effect on the 24-hour calculation.<p></ol></blockquote><h4><a name = "tag_001_014_755">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>The IEEE PASC 1003.2 Interpretations Committee has forwarded concerns about parts of this interface definition to the IEEE PASC Shell and Utilities Working Groupwhich is identifying the corrections.A future revision of this specification will align withIEEE Std. 1003.2b when finalised.</blockquote><h4><a name = "tag_001_014_756">&nbsp;</a>SEE ALSO</h4><blockquote><i><a href="chmod.html">chmod</a></i>,<i><a href="pax.html">pax</a></i>,<i><a href="sh.html">sh</a></i>,<i><a href="test.html">test</a></i>,the <b>XSH</b> specification description of<i><a href="../xsh/stat.html">stat()</a></i>.</blockquote><hr size=2 noshade><center><font size=2>UNIX &reg; is a registered Trademark of The Open Group.<br>Copyright &copy; 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>

⌨️ 快捷键说明

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