Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11429

Re: Please take a look at this bug

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail
From Ángel González <angel@16bits.net>
Newsgroups gnu.bash.bug
Subject Re: Please take a look at this bug
Date Sun, 23 Aug 2015 18:10:41 +0200
Lines 21
Approved bug-bash@gnu.org
Message-ID <mailman.133.1440346250.11330.bug-bash@gnu.org> (permalink)
References <CADo71XMxMFh7y+gp6SGdHsG9Z9_2dfy4UN2K581E2MseAQxJ2w@mail.gmail.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding quoted-printable
X-Trace usenet.stanford.edu 1440346250 3684 208.118.235.17 (23 Aug 2015 16:10:50 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
In-Reply-To <CADo71XMxMFh7y+gp6SGdHsG9Z9_2dfy4UN2K581E2MseAQxJ2w@mail.gmail.com>
X-Mailer Evolution 3.16.5
X-detected-operating-system by eggs.gnu.org: GNU/Linux 3.x
X-Received-From 199.195.249.9
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.14
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:11429

Show key headers only | View raw


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.

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: Please take a look at this bug Ángel González <angel@16bits.net> - 2015-08-23 18:10 +0200

csiph-web