awesome-hacker-search-engines/scripts/check-dups.sh

28 lines
581 B
Bash
Raw Normal View History

2023-04-12 10:15:59 +00:00
#!/bin/bash
2023-04-12 14:18:02 +00:00
#
2023-06-08 10:20:32 +00:00
# https://github.com/edoardottt/awesome-hacker-search-engines
#
2023-04-12 14:18:02 +00:00
# This script checks if there are duplicate entries in the README file.
#
2023-04-12 10:15:59 +00:00
readme="README.md"
2023-04-12 10:21:26 +00:00
pwd=$(pwd)
if [[ "${pwd: -7}" == "scripts" ]];
then
readme="../README.md"
fi
2023-04-12 10:15:59 +00:00
links=$(cat $readme | egrep "\- \[" | wc -l)
uniqlinks=$(cat $readme | egrep "\- \[" | uniq | wc -l)
if [[ $links -eq $uniqlinks ]];
then
2023-04-16 07:15:42 +00:00
echo "[ OK! ] NO DUPLICATES FOUND."
2023-04-16 07:17:30 +00:00
echo "$links links in README."
2023-04-12 10:15:59 +00:00
else
2023-04-16 07:15:42 +00:00
echo "[ ERR ] DUPLICATES FOUND!"
2023-04-12 10:15:59 +00:00
cat $readme | egrep "\- \[" | uniq -c | egrep -iv "1 - ["
fi