bug-bash
[Top][All Lists]
Advanced

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

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


From: Chet Ramey
Subject: Re: declare XXX=$(false);echo $?
Date: Fri, 2 Dec 2022 09:03:40 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.5.0

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 status.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/




reply via email to

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