./bar < <( ./foo )
For example: cat < <(echo "hello there!")
To understand how it works, consider parts of the script separately.
This syntax: cat < /path/to/file
will read the file /path/to/file
and pipe it as stdin to cat
.
This syntax: <(echo "hello there!")
means to execute the command and attach the stdout to a file descriptor like /dev/fd/65
. The result of the whole expression is a text like /dev/fd/65
, and a command run in parallel and feeding that file descriptor.
Now, combined, the script will run the right command, pipe it to a file descriptor, convert that file descriptor to stdin for the left command, and execute the left command.
There is no overhead that I'd know of, it's exactly the same as a | b
, just syntactic sugar.
./bar <(./foo)
./bar < <(./foo)
ifbar
is a script.