On 8/16/25 5:59 AM, Martin D Kealey wrote:
Hi Chet
On Tue, 12 Aug 2025 at 01:18, Chet Ramey <chet.ra...@case.edu
<mailto:chet.ra...@case.edu>> wrote:
On 8/9/25 1:09 AM, Oğuz wrote:
> $ declare -in x=a[x]
> $ echo $?
> 1
> $ declare -p x
> bash: declare: x: not found
Since you have -i, the a[x] expands to `0', which is an invalid name for
a nameref, resulting in an assignment error.
That's … a surprising explanation, especially given that it /looks/ like
infinite recursion.
No different than evaluating a variable value in an expression as an
expression.
I would rather that assignment modifier flags (-i, -l, -u, -r} simply be
ignored when binding.
I'm sure you would, but that's neither backwards compatible nor compatible
with other shells (ksh93, mksh, even zsh) that impletment declare/typeset.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/