Re: setarray[unsetkey] doesn't trigger nounset in arithmetic context

2023-05-21 Thread Greg Wooledge
On Mon, May 22, 2023 at 07:01:18AM +1000, Martin D Kealey wrote: > [...] and treating "unset" as a fatal error is not the experience that > programmers have using other scripting languages, and is therefore, I would > argue, not something that should be added to the Shell, and certainly not > as a

Re: setarray[unsetkey] doesn't trigger nounset in arithmetic context

2023-05-21 Thread Martin D Kealey
(I assume this is a continuation of the discussion in #bash on Libera.chat yesterday?) The primary use of `set -u` is to detect misspelled variable names, and misspelled keys for associative arrays seems like a reasonable extension of that, if you assume that they're in some sense a fixed list,

Re: setarray[unsetkey] doesn't trigger nounset in arithmetic context

2023-05-21 Thread Martin D Kealey
I just realised I expressed an opinion about associative arrays while the original post was about indexed arrays. My take on this is that indexed arrays are almost always "dynamic"; while it's possible to use constant indices to emulate a struct, that is unusual. For most purposes the flexibility

Re: setarray[unsetkey] doesn't trigger nounset in arithmetic context

2023-05-21 Thread Emanuele Torre
On Mon, May 22, 2023 at 09:27:17AM +1000, Martin D Kealey wrote: > I just realised I expressed an opinion about associative arrays while the > original post was about indexed arrays. > I simply reported that, specifically in arithmetic contexts, when using a variable (not as the lhs of an =

Re: `wait -n` returns 127 when it shouldn't

2023-05-21 Thread Aleksey Covacevice
On Thu, May 18, 2023 at 3:07 PM Chet Ramey wrote: > > On 5/18/23 7:51 AM, Robert Elz wrote: > > > Apparently, in bash, if the code is running in a (shell) loop (like inside > > a while, or similar, loop) then each iteration around the loop, any jobs > > that > > have exited, but not been cleaned