awesome-hacker-search-engines/scripts/check-dups.sh
edoardottt e0800c1229 update
2023-04-16 09:15:42 +02:00

25 lines
482 B
Bash
Executable File

#!/bin/bash
#
# This script checks if there are duplicate entries in the README file.
#
readme="README.md"
pwd=$(pwd)
if [[ "${pwd: -7}" == "scripts" ]];
then
readme="../README.md"
fi
links=$(cat $readme | egrep "\- \[" | wc -l)
uniqlinks=$(cat $readme | egrep "\- \[" | uniq | wc -l)
if [[ $links -eq $uniqlinks ]];
then
echo "[ OK! ] NO DUPLICATES FOUND."
else
echo "[ ERR ] DUPLICATES FOUND!"
cat $readme | egrep "\- \[" | uniq -c | egrep -iv "1 - ["
fi