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: Léa Gris
Subject: Re: Behaviour of test -v with assoc array and quote character in key
Date: Tue, 23 Feb 2021 12:51:16 +0100
User-agent: Telnet/1.0 [tlh] (PDP11/DEC)

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]