fix script to work with arrays using bash instead of sh

Change-Id: I5a17cc90f8b523d9d7899bb4367da3acfbf3e002
Merge branch 'cm-10.1' into martincz