I am creating an associative array of source and destination MAC addresses.
$ declare -a SrcDstMap
$ SrcDstMap[\"9c:4e:20:73:e2:72\"]=\"ff:ff:ff:ff:ff:ff\"
-bash
That's not an associative array. You need to use declare -A
, not declare -a
.
$ declare -A SrcDstMap
$ SrcDstMap["9c:4e:20:73:e2:72"]="ff:ff:ff:ff:ff:ff"
$ declare -p SrcDstMap
declare -A SrcDstMap=([9c:4e:20:73:e2:72]="ff:ff:ff:ff:ff:ff" )
declare -a
creates a numerically indexed array, so the shell is trying to parse your index as a number.