bug-bash
[Top][All Lists]
Advanced

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

Re: Behaviour of test -v with assoc array and quote character in key


From: Alex fxmbsw7 Ratchev
Subject: Re: Behaviour of test -v with assoc array and quote character in key
Date: Tue, 23 Feb 2021 12:59:19 +0100

yeah i thought so.. thanks

On Tue, Feb 23, 2021 at 12:52 PM Léa Gris <lea.gris@noiraude.net> wrote:

> Le 23/02/2021 à 12:17, Alex fxmbsw7 Ratchev écrivait :
> > what, sorry, mailing stuff isnt much clear to me, ... its not possible to
> > have a var=\'\] ; assoc[$var] ?
>
> You can if assoc is declared an associative array before:
>
> > $ (LANG=C; unset var assoc; var=\'\]; assoc[$var]=hello; typeset -p
> assoc)
> > bash: ']: syntax error: operand expected (error token is "']")
>
> but:
>
> > $ (LANG=C; unset var assoc; var=\'\]; declare -A assoc;
> assoc[$var]=hello; typeset -p assoc)
> > declare -A assoc=(["']"]="hello" )
>
>
>
>
> --
> Léa Gris
>
>
>


reply via email to

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