I would like to remove multiple elements from an array based on their indexes.
array=("a" "b" "c" "d")
indexes=(1 3)
Output should be
array=("a" "c")
I know how to remove an element from an array knowing the index of the element:
If $i is the index:
array=("${(@)array[1,$i-1]}" "${(@)array[$i+1,$#array]}")
But what if I have multiple elements to remove? If I loop over the array of indexes, once I have removed one element the other indexes won't correspond anymore to the elements to be removed. So how is it possible to do that?