title: How to remove duplicate elements in an existing array in bash?
body: <p>How do I create a newArray containing only the unique elements present in Array?</p>
  
  <p>Ex: ARRAY contains elements <code>aa ab bb aa ab cc</code> at ARRAY[0-5] respectively.</p>
  
  <p>When I print newARRAY, I want only <code>aa ab bb cc</code> at newARRAY[0-3] respectively.</p>
  
  <p>I've searched stack overflow for a while now and nothing is solving my problem. I tried to do <code>newARRAY=$(ARRAY[@] | sort -u | uniq</code>, but duplicated elements still exist.</p>