什么是<<<(命令args)"在外壳上意味着什么? [英] What does "< <(command args)" mean in the shell?
问题描述
当使用包含空格的文件递归遍历文件夹时,我使用的shell脚本具有这种形式,该副本是从复制而来的互联网:
When looping recursively through folders with files containing spaces the shell script I use is of this form, copied from the internet:
while IFS= read -r -d $'\0' file; do
dosomethingwith "$file" # do something with each file
done < <(find /bar -name *foo* -print0)
我想我了解IFS位,但是我不了解'<<(...)
"字符的意思.显然,这里有种管道.
I think I understand the IFS bit, but I don't understand what the '< <(...)
' characters mean. Obviously there's some sort of piping going on here.
您会发现Google很难做到<<".
It's very hard to Google "< <", you see.
推荐答案
<()
is called process substitution in the manual, and is similar to a pipe but passes an argument of the form /dev/fd/63
instead of using stdin.
<
从命令行上命名的文件中读取输入.
<
reads the input from a file named on command line.
一起,这两个运算符的功能完全类似于管道,因此可以将其重写为
Together, these two operators function exactly like a pipe, so it could be rewritten as
find /bar -name *foo* -print0 | while read line; do
...
done
这篇关于什么是<<<(命令args)"在外壳上意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!