Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail From: Greg Wooledge 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: References: 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" To: PRC Envelope-to: bug-bash@gnu.org Content-Disposition: inline In-Reply-To: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11322 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