Re: Bash silently exits where attempting to assign an array to certain b
From:
Chet Ramey
Subject:
Re: Bash silently exits where attempting to assign an array to certain built-in variables using declare
Date:
Thu, 29 Jun 2023 12:10:37 -0400
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.12.0
On 6/29/23 8:51 AM, Chet Ramey wrote:
It should be consistent, at least. I think the string assignment behavior
is the most reasonable: assignments return 1 but there's no assignment
error. I'll look at how compound assignments are different.
I have reconsidered this. Making assignments that are supposed to be
ignored set $? to 1 means that a shell with errexit enabled will exit.
I don't think that's desirable. I don't think attempted assignments to
noassign variables should change $?.
Chet
--
``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/