My goal is to take a set of vectors, which run over an index i, and reduce their dimensionality by one for every zero in the array. In particular, I have a set of vectors which have elements

vecA_$i=[ a 0 0 0 0 0 0 0 0 0 0 0 0 0 0 b ]

and I just want to reindex them to have the vector [ a b ]. If I have just one vector, I can do

VecA_1=("${VecA_1[@]:0}")

and this works just fine. However, I am having difficulty doing this over a loop. I attempted to do

for (( i=1; i<=$directory; i++ ))

do

VecA_$i=("${VecA_$i[@]:0}")

done

but this results in a syntax error on the definition line. Can anyone advise how to perform a do loop over a matrix dimensionality reduction?