I\'ve got almost the same question as here.
I have an array which contains aa ab aa ac aa ad, etc.
Now I want to select all unique elements from this ar
If you want a solution that only uses bash internals, you can set the values as keys in an associative array, and then extract the keys:
declare -A uniqs
list=(foo bar bar "bar none")
for f in "${list[@]}"; do
uniqs["${f}"]=""
done
for thing in "${!uniqs[@]}"; do
echo "${thing}"
done
This will output
bar
foo
bar none