在 Linux 中,我的目录中有一个名为 test2 的文件,该文件是我使用 touch 命令创建的。
当我运行命令时
find . –name “*test*” -ls
它不会给我错误,但是当我运行时
find . –name *test* -ls
它给了我一个错误
find: paths must precede expression: test2 Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
这是为什么?
最佳答案
*test*
获取 glob expanded by your shell (分成多个 token )。
而 "*test*"
中不会发生全局扩展,因为周围的 "
符号会阻止全局扩展。
关于linux - 这两个命令之间的区别(w & w/out "")以及为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37193881/