[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: |
Mon, 5 Dec 2022 09:16:09 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 |
On 12/2/22 8:26 PM, Martin D Kealey wrote:
If anything is weird, it's that simple (bare) assignments set $? to 0
UNLESS there's a command substitution providing a status.
Why not, if the assignment is performed successfully? POSIX says all errors
in that context are fatal for non-interactive shells, but interactive
shells continue.
--
``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/
Re: declare XXX=$(false);echo $?, Martin D Kealey, 2022/12/02