On Thu, 29 Jun 2023 12:10:37 -0400 Chet Ramey <chet.ra...@case.edu> wrote:
> 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 $?. That seems reasonable to me. It would also make it less likely that the evaluation of the prior output of declare -p - be in whole or in part - affects the value of $?, which seems like a win. -- Kerin Millar