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: Alex fxmbsw7 Ratchev
Subject: Re: Issue declaring an array via a variable name
Date: Sun, 22 Aug 2021 00:09:50 +0200

i wrote, i write again
declare "var=value"
not
declare "var"="value"

On Sun, Aug 22, 2021, 00:02 Hunter Wittenborn <hunter@hunterwittenborn.com>
wrote:

> > 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]