Last active
August 31, 2018 06:36
-
-
Save Cvetomird91/90cbf37f44a35408c7563426906a852a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
containsElement () { | |
local e match="$1" | |
shift | |
for e; do [[ "$e" == "$match" ]] && return 0; done | |
return 1 | |
} | |
contents=() | |
OIFS="$IFS" | |
IFS=$'\n' | |
for file in `find . -type f`; do | |
content=$(cat "$file"); | |
if ! containsElement $content ${contents[@]}; | |
then contents=(${contents[@]} $content); | |
fi; | |
done | |
IFS="$OIFS" | |
echo "unique files count = ${#contents[*]}"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment