Re: set -e ignored in subshell if part of command list

2019-11-15 Thread Chet Ramey
On 11/14/19 6:02 PM, Ángel wrote: On 2019-11-13 at 11:30 -0500, Chet Ramey wrote: On 11/13/19 10:59 AM, Shaun Crampton wrote: But the commands in the subshell execute inside a different shell execution context so they shouldn't have their own set -e context (Section 2.12)? Why? That section s

Re: set -e ignored in subshell if part of command list

2019-11-14 Thread Eli Schwartz
On 11/14/19 6:02 PM, Ángel wrote: > I would say that the confusing part is that the behavior of the subshell > is dependant on *where* it is being executed in the parent. > > In general terms, I would expect > ( ) > to be roughly equivalent to > bash -c "" > > i.e. being executed on its ow

Re: set -e ignored in subshell if part of command list

2019-11-14 Thread Ángel
On 2019-11-13 at 11:30 -0500, Chet Ramey wrote: > On 11/13/19 10:59 AM, Shaun Crampton wrote: > > But the commands in the subshell execute inside a different shell > > execution context so they shouldn't have > > their own set -e context (Section 2.12)? > > Why? That section says the only thing th

Re: set -e ignored in subshell if part of command list

2019-11-13 Thread Eli Schwartz
On 11/13/19 10:59 AM, Shaun Crampton wrote: > But the commands in the subshell execute inside a different shell > execution context so they shouldn't have > their own set -e context (Section 2.12)? > > I don't see where the spec says that the subshell has to inherit the > and/or list-ness of the >

Re: set -e ignored in subshell if part of command list

2019-11-13 Thread Chet Ramey
On 11/13/19 10:59 AM, Andrew Church wrote: "The -e setting shall be ignored when executing the compound list following the while, until, if, or elif reserved word, a pipeline beginning with the ! reserved word, or any command of an AND-OR list other than the last." (from https://pubs.opengroup.o

Re: set -e ignored in subshell if part of command list

2019-11-13 Thread Chet Ramey
On 11/13/19 10:59 AM, Shaun Crampton wrote: But the commands in the subshell execute inside a different shell execution context so they shouldn't have their own set -e context (Section 2.12)? Why? That section says the only thing that changes in the subshell environment is signal dispositions.

Re: set -e ignored in subshell if part of command list

2019-11-13 Thread Andrew Church
>"The -e setting shall be ignored when executing the compound list following >the while, until, if, or elif reserved word, a pipeline beginning with the >! reserved word, or any command of an AND-OR list other than the last." > >(from >https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_

Re: set -e ignored in subshell if part of command list

2019-11-13 Thread Shaun Crampton
But the commands in the subshell execute inside a different shell execution context so they shouldn't have their own set -e context (Section 2.12)? I don't see where the spec says that the subshell has to inherit the and/or list-ness of the parent context. Section 2.12 doesn't mention that as bei

Re: set -e ignored in subshell if part of command list

2019-11-13 Thread Chet Ramey
On 11/13/19 5:24 AM, Shaun Crampton wrote: Bash Version: 5.0 Patch Level: 3 Release Status: release Description: I was trying to get a function to return early if a command fails by putting the body of the function in a subshell and using set -e inside the subshell. If I