Removing large files; adding hook to watch for them
This commit is contained in:
@@ -17,10 +17,11 @@ function findBadTerm() {
|
||||
# param term: the term to search for duplicates
|
||||
file="$1"
|
||||
term="$2"
|
||||
results="$(grep "$term:" "$file" | sed 's/\s\+'"$term"':\s*//' | sort)"
|
||||
results="$(grep -i "$term:" "$file" | tr '[[:upper:]]' '[[:lower:]]' | sed 's/\s+'"$term"':\s*//' | sort | uniq -c | grep -vE '^\s+1\s+' )"
|
||||
|
||||
if ! diff <(echo "$results") <(echo "$results" | uniq); then
|
||||
echo "Some ${term^^} entries are duplicated. Search for the above terms in your inventory and deduplicate."
|
||||
if [ -n "$results" ]; then
|
||||
echo "Some ${term} entries are duplicated. Search for the above terms in your inventory and deduplicate."
|
||||
echo "$results"
|
||||
exit 2
|
||||
fi
|
||||
}
|
||||
|
Reference in New Issue
Block a user