[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Doc on simple command expansion
From: |
Glen Huang |
Subject: |
Re: Doc on simple command expansion |
Date: |
Sat, 5 Mar 2022 22:15:50 +0800 |
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