First let me state my problem clearly:
Ex: Let's pretend this is my array, (the elements don't matter as in my actual code they vary):
array=(jim 0 26 chris billy 78 hello foo bar)
Now say I want to remove the following elements:
chris 78 hello
So I did: unset array[$i] while looping through the array.
This removes the elements correctly, however, i end up with an array that looks like this:
array=(jim 0 26 '' billy '' '' foo bar)
I need it to look like this:
array=(jim 0 26 billy foo bar)
where jim is at index 0, 0@1, 26@2, etc..
How do I delete the elements in the array and move the other elements so that there are no null/empty spaces in the array?
Thanks!