Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 这两个命令(w&w/out";)之间的区别及其原因?_Linux_Centos_Find - Fatal编程技术网

Linux 这两个命令(w&w/out";)之间的区别及其原因?

Linux 这两个命令(w&w/out";)之间的区别及其原因?,linux,centos,find,Linux,Centos,Find,在linux中,我在使用touch命令创建的目录中有一个名为test2的文件 当我运行命令时 find . –name “*test*” -ls 它不会给我一个错误,但是当我运行时 find . –name *test* -ls 它给了我一个错误 find:路径必须位于表达式test2之前 用法:find[-H][L][P][Olevel][D help | tree | search | stat | rates | opt | exec][path…][expression] 这是为什么

在linux中,我在使用touch命令创建的目录中有一个名为test2的文件

当我运行命令时

find . –name “*test*” -ls
它不会给我一个错误,但是当我运行时

find . –name *test* -ls
它给了我一个错误

find:路径必须位于表达式test2之前 用法:find[-H][L][P][Olevel][D help | tree | search | stat | rates | opt | exec][path…][expression]

这是为什么?

*测试*
获取(多个令牌)


然而,
“*test*”
中没有全局扩展,因为周围的
符号阻止全局搜索。

您的shell正在拦截
*test*
并在当前目录中查找与该表达式匹配的文件和目录,然后将扩展列表传递给
查找
find
要求在该点中只有一个字符串,而扩展列表可能是0个或多个字符串

使用引号时,shell将忽略星号,并将原始字符串
*test*
传递给
find
,然后按照预期将这些星号用作通配符