On Fri, Apr 9, 2021 at 4:08 AM Greg Wooledge <g...@wooledge.org> wrote:
> But apparently someone stumbled upon this trick, and passed it around,
> and now there's a whole subculture of people who use this as a hack for
> trying to pass array variables to functions by reference.  (This hack
> predates declare -n.)

It's not a hack since indirection allows references to:

1) Digit-based parameters ($1, $2, etc.)
2) Special variables (which includes $@)
3) Valid array references (array[@] and array[1 + 1] are one of them)
4) Legal identifiers

It's a definite shell feature despite lacking internal sanity checks.

-- 
konsolebox

Reply via email to