title: How to remove an element from a bash array without flattening the array
body: <p>I would like to make a function that takes a bash array like this one:</p>
  
  <pre><code>a=("element zero" "element one" "element two")
  </code></pre>
  
  <p>and removes one element like "element one" and leaves a the array like this:</p>
  
  <pre><code>a=("element zero" "element two")
  </code></pre>
  
  <p>such that <code>echo $a[1]</code> will print out <code>element two</code> and not <code>zero</code>.</p>
  
  <p>I've seen several attempts at this, but haven't found one that did it cleanly or without breaking elements that have spaces into multiple elements. Or just setting the element to be blank (i.e. not shifting the indexes of subsequent array elements).</p>