[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: -v no longer works for associative arrays
From: |
Greg Wooledge |
Subject: |
Re: -v no longer works for associative arrays |
Date: |
Thu, 13 Oct 2022 14:54:47 -0400 |
On Thu, Oct 13, 2022 at 02:35:55PM -0400, Chet Ramey wrote:
> On 10/13/22 12:47 PM, Bryan Roessler wrote:
> > For indexed arrays, yes. I hadn't made the connection with associative
> > arrays since I don't typically index them with numbers, thanks.
>
> There has to be some default, and "0" is at least consistent with indexed
> arrays.
I actually would have preferred an error message. Something like
"bash: test: missing array index" would have been clear enough for me.
The current behavior is absolutely mystifying for most people.
I'm not actually requesting a change. I recognize that it's far too
late for that. Hmm...
If at some point you choose to add a shopt that turns on extra warnings,
I'd love it if *this* could be included in said warnings. The use of an
array variable with no index, having index "0" be chosen for you, is
worthy of a warning, in such a hypothetical mode.
Re: -v no longer works for associative arrays, Greg Wooledge, 2022/10/13