Re: declare XXX=$(false);echo $?

2022-12-02 Thread Martin D Kealey
On Fri, 2 Dec 2022 at 20:28, Ulrich Windl wrote: > Surprisingly "declare XXX=$(false);echo $?" outputs "0" (not "1") > "Surprising" is subjective. There is no indication in the manual page that "declare" ignores the exit > code of commands being executed to set values. > Framing this as

Re: declare XXX=$(false);echo $?

2022-12-02 Thread Dale R. Worley
Chet Ramey writes: > On 12/2/22 5:28 AM, Ulrich Windl wrote: >> Surprisingly "declare XXX=$(false);echo $?" outputs "0" (not "1") >> There is no indication in the manual page that "declare" ignores the >exit code of commands being executed to set values. > > Why do you think it should? `declare'

Re: declare XXX=$(false);echo $?

2022-12-02 Thread Chet Ramey
On 12/2/22 5:28 AM, Ulrich Windl wrote: Surprisingly "declare XXX=$(false);echo $?" outputs "0" (not "1") There is no indication in the manual page that "declare" ignores the exit code of commands being executed to set values. Why do you think it should? `declare' has a well-defined return

Re: declare XXX=$(false);echo $?

2022-12-02 Thread Greg Wooledge
On Fri, Dec 02, 2022 at 11:28:50AM +0100, Ulrich Windl wrote: > Surprisingly "declare XXX=$(false);echo $?" outputs "0" (not "1") https://mywiki.wooledge.org/BashPitfalls#pf27

Re: declare XXX=$(false);echo $?

2022-12-02 Thread David
On Fri, 2 Dec 2022 at 21:29, Ulrich Windl wrote: > Surprisingly "declare XXX=$(false);echo $?" outputs "0" (not "1") > There is no indication in the manual page that "declare" ignores > the exit code of commands being executed to set values. The above is not surprising at all. 'declare' is a

declare XXX=$(false);echo $?

2022-12-02 Thread Ulrich Windl
Surprisingly "declare XXX=$(false);echo $?" outputs "0" (not "1") There is no indication in the manual page that "declare" ignores the exit code of commands being executed to set values. Actually I's consider it to be a ASH bug, not a documentation bug. Found in the real code (intended to