Arrays Comparison code example
Example 1: how to compare elements in an array
for (let i = 0; i < a.length; i++) {
for (let k = i + 1; k < a.length; k++) {
if (a[i] != a[k]) {
//do stuff
}
}
}
Example 2: compare two arrays
echo ${Array1[@]} ${Array2[@]} | tr ' ' '\n' | sort | uniq -u