Re: [Help-bash] What keys are not allowed in an associative array?
From:
Greg Wooledge
Subject:
Re: [Help-bash] What keys are not allowed in an associative array?
Date:
Mon, 11 Jun 2018 08:25:57 -0400
User-agent:
NeoMutt/20170113 (1.7.2)
On Sat, Jun 09, 2018 at 06:03:31PM -0500, Peng Yu wrote:
> I see @ and * are not allowed. Is there anything else that is not allowed?
The empty string is not allowed. As far as I know, that's the only one.
@ and * are allowed, if properly quoted.
wooledg:~$ declare -A aa
wooledg:~$ aa[""]=foo
bash-5.0: aa[""]: bad array subscript
wooledg:~$ aa["@"]=foo
wooledg:~$ declare -p aa
declare -A aa=(["@"]="foo" )