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

25 lines
466 B
Bash
Raw Normal View History

2023-04-12 10:15:59 +00:00
#!/bin/bash
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
echo "NO DUPLICATES FOUND."
else
echo "DUPLICATES FOUND!"
cat $readme | egrep "\- \[" | uniq -c | egrep -iv "1 - ["
fi