Mostafa Nazari wrote:
> bug_part <(echo "TEST")

The <(echo "TEST") construct creates a pipe. You can view it just
printing the value that gets passed to the program:
$ echo <(echo "TEST")
/dev/fd/63

Now, a problem of that pipe is that the contents can only be read once.
Indeed, what would the second read do? Run echo "TEST" again? Should
the full file be stored in a temporary file "just in case you want to
read it again"? What you are trying to do is not supported.

It has some benefits, too. For instance:
$ function foo() { head -c 2 $1 > /tmp/a; head -c 2 $1 > /tmp/b; }
$ foo <(echo TEST)
will store "TE" in /tmp/a and "ST" in /tmp/b, as it's not rewinded.

Also note that other devices like tapes or sockets also have this "you
can only read once" limitation.

Reply via email to