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

From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: -e does not take effects in subshell
Date 2015-08-11 09:50 -0400
Message-ID <mailman.8134.1439301065.904.bug-bash@gnu.org> (permalink)
References <BLU176-W28809FB59FF9274B34D871D67F0@phx.gbl>

Show all headers | 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