arch-repo/bash-unique-array-test.sh

13 lines
185 B
Bash
Raw Permalink Normal View History

2022-07-16 17:02:02 +02:00
#!/bin/bash
#
# source: https://stackoverflow.com/a/13649357
#
a=(aa ac aa ad "ac ad")
declare -A b
for i in "${a[@]}"; do b["$i"]=1; done
for i in "${!b[@]}"; do
echo ">> $i"
done