使用“-type d”测试时,为什么会在非目录中查找管道?

Bri*_*ick 3 pipe find gnu-parallel

我有一个目录

~/root/
|-- bar
|-- eggs
|-- foo
|-- hello.txt
|-- script.sh
`-- spam

4 directories, 2 files
Run Code Online (Sandbox Code Playgroud)

find . -type d~/root/收益中发行

.
./spam
./eggs
./bar
./foo
Run Code Online (Sandbox Code Playgroud)

然而,发行find . -type d | parallel "echo {}" ::: *收益率

bar
eggs
foo
hello.txt
script.sh
spam
Run Code Online (Sandbox Code Playgroud)

为什么非目录hello.txtscript.sh管道在这里?

Fox*_*Fox 15

根据手册::: *语法使用 shell 的扩展*作为参数列表,而不是任何来自stdin. 正如所写的那样,您的命令会忽略find当前目录中的所有文件的结果并将其作为参数传递。如果您不使用::: *,它应该可以按预期工作。