bug-bash
[Top][All Lists]
Advanced

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

Re: Possible bug when combining Bash's process substitution with HERE-do


From: Greg Wooledge
Subject: Re: Possible bug when combining Bash's process substitution with HERE-document?
Date: Fri, 20 Jun 2014 08:20:43 -0400
User-agent: Mutt/1.4.2.3i

On Fri, Jun 20, 2014 at 12:00:02AM +0200, Tim Friske wrote:
> While searching for an alternative I came up with the following code
> which does not work when I have the "shopt -os errexit" command line
> at the top of my script:
> 
> read -d '' -r foobar <<BARFOO
> bla bla
> BARFOO

read returns "failure" because it reaches end of file without
encountering the delimiter character (0x00).

This is why you don't use set -e (or errexit, or trap ERR, or any of
the other syntaxes by which this misfeature is invoked).

For more fun details, see http://mywiki.wooledge.org/BashFAQ/105
You may be amazed at how incredibly broken set -e actually is.

Bourne shell and C were developed at a time when it was NOT the
standard practice for programming languages to handle exceptions/errors
for you.  You need to check the results of each operation yourself.



reply via email to

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