I am trying to create an associative array in Bash in the following way:
#!/bin/bash
hash["name"]='Ashwin'
echo ${hash["name"]}
This prints the desired output, Ashwin, when executed.
But when the key has a space in it,
#!/bin/bash
hash["first name"]='Ashwin'
echo ${hash["first name"]}
I get the following error
test2.sh: line 2: first name: syntax error in expression (error token is "name")
Are keys not allowed to have spaces in them?