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
Try this:
$ array=( "one two" "three four" "five six" )
$ unset array[1]
$ array=( "${array[@]}" )
$ echo ${array[0]}
one two
$ echo ${array[1]}
five six
Shell arrays aren't really intended as data structures that you can add and remove items from (they are mainly intended to provide a second level of quoting for situations like
arr=( "one two" "three four" )
somecommand "${arr[@]}"
to provide somecommand
with two, not four, arguments). But this should work in most situations.