I am trying to construct an associative array in bash
#!/bin/bash declare -A hero_escore hero_escore=( "Invoker_Anti-Mage : -44" "Tinker_Nyx Assassin : 32" "Troll Warlord_Drow Ranger : 3" )
These are 3 different lines. It is intended to be like that only. But the above code gives an error for each line -
Troll Warlord_Drow Ranger : 3: must use subscript when assigning associative array. Is it because it is expecting me to use something like this -
[Invoker_Anti-Mage]="-44"? If so is there anyway I can make it work the way I have used in my program using bash 3 or something? I want to construct an associative array with the format that I have given. Is it possible?