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

26 lines
517 B
Bash
Raw Normal View History

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