Bash | compare two arrays | compare two strings

comm -12 <(printf ‘%s\n’ “${ARRAY1[@]}” | LC_ALL=C sort) <(printf ‘%s\n’ “${ARRAY2[@]}” | LC_ALL=C sort) comm -12 <(printf ‘%s\n’ ${STRING1} | LC_ALL=C sort) <(printf ‘%s\n’ ${STRING2} | LC_ALL=C sort)