bug-bash
[Top][All Lists]
Advanced

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

Re: -e does not take effects in subshell


From: Greg Wooledge
Subject: Re: -e does not take effects in subshell
Date: Tue, 11 Aug 2015 09:50:56 -0400
User-agent: Mutt/1.4.2.3i

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



reply via email to

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