fix script to work with arrays using bash instead of sh

Change-Id: I5a17cc90f8b523d9d7899bb4367da3acfbf3e002