[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Please take a look at this bug

From: Ángel González
Subject: Re: Please take a look at this bug
Date: Sun, 23 Aug 2015 18:10:41 +0200

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")

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

[Prev in Thread] Current Thread [Next in Thread]