Skip to content

Instantly share code, notes, and snippets.

@Cvetomird91
Last active August 31, 2018 06:36
Show Gist options
  • Save Cvetomird91/90cbf37f44a35408c7563426906a852a to your computer and use it in GitHub Desktop.
Save Cvetomird91/90cbf37f44a35408c7563426906a852a to your computer and use it in GitHub Desktop.
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