bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issue declaring an array via a variable name


From: Hunter Wittenborn
Subject: Re: Issue declaring an array via a variable name
Date: Sat, 21 Aug 2021 17:02:12 -0500
User-agent: Zoho Mail

> As an end user I would expect the unquoted `('

> operator to cause a syntax error, just as it does in `echo ('.



Well I'm expecting '(' to be part of the shell's syntax (when unquoted; so 
likewise not cause a syntax error), but when looking at things like the left 
side of a variable assignment, I'm sure you'll agree that it should allow any 
string that fits a variable's normal specification (regardless of being an 
array or not).



Maybe this will explain how I'm thinking about it:



In my head, something like this (where 'value' is equal to 'y'):



`declare "${value}"="x"`



becomes this (which it appears to do so):



`declare "y"="x"`



Logically (for me anyway), this:



`declare "${value}"=("x" "z")`



should then become this:



`declare "y"=("x" "z")`


reply via email to

[Prev in Thread] Current Thread [Next in Thread]