fix script to work with arrays using bash instead of sh

Change-Id: I5a17cc90f8b523d9d7899bb4367da3acfbf3e002
Merge remote-tracking branch 'cm/cm-10.1' into jb-mr1