|
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
[Prev in Thread] | Current Thread | [Next in Thread] |