[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Changing the way bash expands associative array subscripts
From: |
konsolebox |
Subject: |
Re: Changing the way bash expands associative array subscripts |
Date: |
Fri, 9 Apr 2021 08:17:52 +0800 |
On Fri, Apr 9, 2021 at 4:08 AM Greg Wooledge <greg@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
- Re: Changing the way bash expands associative array subscripts, (continued)
- Re: Changing the way bash expands associative array subscripts, Koichi Murase, 2021/04/19
- Re: Changing the way bash expands associative array subscripts, Chet Ramey, 2021/04/13
- Re: Changing the way bash expands associative array subscripts, Koichi Murase, 2021/04/13
- Re: Changing the way bash expands associative array subscripts, Koichi Murase, 2021/04/13
- Re: Changing the way bash expands associative array subscripts, Chet Ramey, 2021/04/15
- Re: Changing the way bash expands associative array subscripts, konsolebox, 2021/04/15
- Re: Changing the way bash expands associative array subscripts, Koichi Murase, 2021/04/16
- Re: Changing the way bash expands associative array subscripts, Chet Ramey, 2021/04/18
- Re: Changing the way bash expands associative array subscripts, konsolebox, 2021/04/18
- Re: Changing the way bash expands associative array subscripts, Koichi Murase, 2021/04/19
- Re: Changing the way bash expands associative array subscripts,
konsolebox <=
- Re: Changing the way bash expands associative array subscripts, konsolebox, 2021/04/08
- Re: Changing the way bash expands associative array subscripts, Greg Wooledge, 2021/04/09
- Re: Changing the way bash expands associative array subscripts, konsolebox, 2021/04/09
- Re: Changing the way bash expands associative array subscripts, Chet Ramey, 2021/04/12
- Re: Changing the way bash expands associative array subscripts, Chet Ramey, 2021/04/12
- Re: Changing the way bash expands associative array subscripts, Chet Ramey, 2021/04/08
- Re: Changing the way bash expands associative array subscripts, L A Walsh, 2021/04/13
- Re: Changing the way bash expands associative array subscripts, konsolebox, 2021/04/13
- Re: Changing the way bash expands associative array subscripts, Chet Ramey, 2021/04/13
- Re: Changing the way bash expands associative array subscripts, Chet Ramey, 2021/04/08