On Thu, Apr 8, 2021, 06:56 konsolebox, <konsole...@gmail.com> wrote: > On Thu, Apr 8, 2021 at 2:44 AM Chet Ramey <chet.ra...@case.edu> wrote: > > Indirection does not check whether or not the variable it's indirecting > > is $@/$* or ${array[@/*]}. It simply goes by the return value. > > It looks like it can easily be fixed with this: > > diff --git a/subst.c b/subst.c > index 4f12f22d..cc9a6803 100644 > --- a/subst.c > +++ b/subst.c > @@ -9245,7 +9245,13 @@ parameter_brace_expand (string, indexp, quoted, > pflags, quoted_dollar_atp, conta > } > > #if defined (ARRAY_VARS) > - if (valid_array_reference (name, 0)) > + if (want_indir) > + { > + if (*contains_dollar_at) { > + all_element_arrayref = 1; > + } > + } > + else if (valid_array_reference (name, 0)) > { > int qflags; > char *t; >
Chet: Also this one. Any further thoughts? This fix looks simple enough to allow consistency. -- konsolebox