bug-bash
[Top][All Lists]
Advanced

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

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


From: Lawrence Velázquez
Subject: Re: [EXT] Re: declare XXX=$(false);echo $?
Date: Mon, 05 Dec 2022 03:09:27 -0500
User-agent: Cyrus-JMAP/3.7.0-alpha0-1115-g8b801eadce-fm-20221102.001-g8b801ead

On Mon, Dec 5, 2022, at 2:47 AM, Ulrich Windl wrote:
> So basically the behavior is as documented (not a bug), but the design
> decision was poor:
>
>   declare a
>   a=b
>
> has a different semantic as
>   declare a=b
>
> which I consider to be bad.

You're free to think so, but this behavior is ubiquitous among
Bourne-adjacent shells and is not about to change.

        % cat foo.sh
        export foo=$(false)
        echo "$?"

        % bash foo.sh
        0
        % ksh foo.sh 
        0
        % zsh foo.sh
        0
        % dash foo.sh
        0
        % yash foo.sh
        0

-- 
vq



reply via email to

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