Closed pbandzi closed 9 years ago
Hi Peter, I think this is OK. We can use names as the key for an associative array: http://www.artificialworlds.net/blog/2012/10/17/bash-associative-array-examples/
But you are right it looks like there is a bug because I don't declare it explicitly:
$ blah[em1]=0
$ blah[em2]=1
$ blah[em3]=2
$ echo ${blah[em2]}
2
$ echo ${blah[em3]}
2
$ echo ${blah[em1]}
2
$ declare -A MYMAP
$ MYMAP[em1]=0
$ MYMAP[em2]=1
$ MYMAP[em3]=2
$ echo ${MYMAP[em1]}
0
$ echo ${MYMAP[em2]}
1
$ echo ${MYMAP[em3]}
2
Will patch this by adding the declare statement. Thanks for finding this!
Fixed and closed. Thanks @pbandzi for finding this!
line 285 in deploy.sh interface_arr[$interface]=$if_counter
variable $interface is not a number (it is name of interface). so during the for cycle the expression is always: interface_arr[0]=$if_counter
we used instead (not sure if it is ok with rest of the code however) interface_arr[$if_counter]=$if_counter