On Fri, Mar 4, 2022 at 9:58 PM Chet Ramey <chet.ramey@case.edu> wrote:
>
> On 3/3/22 9:42 PM, Glen Huang wrote:
>
> > I'm still wondering if it's possible to make bash exit at "false" in
> > echo $(false)? Simple "set -e" doesn't seem to cut it.
>
> It is not. When there is a command to execute, it determines $?. In this
> case, the `echo' succeeded (it only fails on write errors).
>
> > Is assigning $(false) to a variable first the only option?
>
> Yes. Letting the command substitution determine the exit status of an
> assignment is the special case.
Thanks for the confirmation. All clear.
Regards,
Glen