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


Groups > gnu.bash.bug > #11322

Re: -e does not take effects in subshell

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail
From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: -e does not take effects in subshell
Date Tue, 11 Aug 2015 09:50:56 -0400
Lines 26
Approved bug-bash@gnu.org
Message-ID <mailman.8134.1439301065.904.bug-bash@gnu.org> (permalink)
References <BLU176-W28809FB59FF9274B34D871D67F0@phx.gbl>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace usenet.stanford.edu 1439301065 25096 208.118.235.17 (11 Aug 2015 13:51:05 GMT)
X-Complaints-To action@cs.stanford.edu
Cc "bug-bash@gnu.org" <bug-bash@gnu.org>
To PRC <ijkxyz@msn.com>
Envelope-to bug-bash@gnu.org
Content-Disposition inline
In-Reply-To <BLU176-W28809FB59FF9274B34D871D67F0@phx.gbl>
User-Agent Mutt/1.4.2.3i
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From 139.137.100.1
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:11322

Show key headers only | View raw


On Tue, Aug 11, 2015 at 11:42:29AM +0000, PRC wrote:
> mybuild()
> {
>     (
>         set -e
>         make
>         echo "build okay"
>     )
> }
> 
> mybuild && do_other_stuff

http://mywiki.wooledge.org/BashFAQ/105

Since mybuild is invoked as part of a compound command, set -e is
suppressed.  I guess this applies not only to set -e that's invoked
beforehand, but even to set -e that's set within the compound command.

Stop using set -e and all of these problems simply go away.

mybuild() {
    make && echo "build okay"
}

mybuild && do_other_stuff

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


Thread

Re: -e does not take effects in subshell Greg Wooledge <wooledg@eeg.ccf.org> - 2015-08-11 09:50 -0400

csiph-web