这是我输入时得到的内容的开头info find
find [-H] [-L] [-P] [-D DEBUGOPTIONS] [-OLEVEL] [FILE...] [EXPRESSION]
'find' searches the directory tree rooted at each file name FILE by
评估在树中找到的每个文件的表达式。
我假设 [] 里面的内容是可选的,还是强制的,这是正确的吗?
以下是 find 命令的一些示例:
How can I recursively find all files in current and subfolders based on wildcard matching?
find . -name "foo*"
以下内容如何适合此处:
.
-name
"foo*"
我找到的这些信息是不是过时了几十年?
还是根本不正确?
还是我读错了?
编辑:
看到第一个答案后,我必须承认这不是表达。至少根据手册和信息页面判断。
EXPRESSION
The part of the command line after the list of starting points is the expression. This is a
kind of query specification describing how we match files and what we do with the files that
were matched. An expression is composed of a sequence of things:
Tests Tests return a true or false value, usually on the basis of some property of a file we
are considering. The -empty test for example is true only when the current file is
empty.
Actions
Actions have side effects (such as printing something on the standard output) and
return either true or false, usually based on whether or not they are successful. The
-print action for example prints the name of the current file on the standard output.
Global options
Global options affect the operation of tests and actions specified on any part of the
command line. Global options always return true. The -depth option for example makes
find traverse the file system in a depth-first order.
Positional options
Positional optiona affect only tests or actions which follow them. Positional options
always return true. The -regextype option for example is positional, specifying the
regular expression dialect for regulat expressions occurring later on the command line.
Operators
Operators join together the other items within the expression. They include for exam‐
ple -o (meaning logical OR) and -a (meaning logical AND). Where an operator is miss‐
ing, -a is assumed.
If the whole expression contains no actions other than -prune or -print, -print is performed
on all files for which the whole expression is true.
The -delete action also acts like an option (since it implies -depth).
-name
它根本没有提到,-name
听起来也不像Test, Action, Global Option, Positional Option or Operator
。手册页甚至没有解释那些东西是什么?
这似乎是软件文档历史上最糟糕的手册/信息页面。
答案1
不,它并没有过时 - 尽管常规手册页中的版本(man find
而不是info find
)可能更容易理解:
find [-H] [-L] [-P] [-D debugopts] [-Olevel] [path...] [expression]
如果是
find . -name "foo*"
.
是小路(称为文件在信息页面中)-name "foo*"
是一个表达
其余选项[-H] [-L] [-P] [-D debugopts] [-Olevel]
均为空。
请注意,GNU find 在使path
和expression
可选方面有些不寻常;因此简单的命令
find
将从当前目录开始递归地查找所有文件(和目录);为了可移植性,您经常会看到人们更喜欢像.
您的示例中那样明确指定当前目录。