title: Find duplicate elements in associative array with non consecutive index
body: <p>i'm starting with bash and code in general and have a lot of pain to write this, can anyone tell me if it will work in every case please, maybe someone have a better approach? 
  Many thanks in advance.</p>
  
  <pre><code>array=( [0]=24 [1]=24 [5]=10 [6]=24 [10]=24 [12]=12 )
  KEYS=(${!array[@]})
  
  for i in "${!KEYS[@]}"; do
  
      for j in "${!KEYS[@]}"; do
  
      if [[ $i -eq $j ]]; then
          continue
      fi
  
      if [[ ${array[${KEYS[$i]}]} -eq ${array[${KEYS[$j]}]} ]]; then
  
          duplicate+=( ${KEYS[$j]} )
      fi
      done
  
  done
  
  uniq=($(printf "%s\n" "${duplicate[@]}" | sort -u)); 
  
  echo "${uniq[@]}"
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>my expected output is an array containing index of duplicated elements.</p>