什么是<<<(命令args)"在外壳上意味着什么? [英] What does "< <(command args)" mean in the shell?

查看:55
本文介绍了什么是<<<(命令args)"在外壳上意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用包含空格的文件递归遍历文件夹时,我使用的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

这篇关于什么是&lt;&lt;&lt;(命令args)"在外壳上意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆