mirror of https://github.com/dnomd343/ClearDNS
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
741 B
36 lines
741 B
3 years ago
|
SOURCE="$0"
|
||
|
while [ -h "$SOURCE" ]; do
|
||
|
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||
|
SOURCE="$(readlink "$SOURCE")"
|
||
|
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
|
||
|
done
|
||
|
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||
|
cd $DIR
|
||
|
|
||
|
let num=1
|
||
|
while read -r cmd
|
||
|
do
|
||
|
eval $cmd" > data_"$num
|
||
|
let num++
|
||
|
done < source.sh
|
||
|
|
||
|
files=""
|
||
|
for ((i=1;i<$num;i++))
|
||
|
do
|
||
|
files="$files data_$i"
|
||
|
done
|
||
|
eval "cat $files | sort -u > data"
|
||
|
eval "rm -f $files"
|
||
|
|
||
|
cat /dev/null > output.txt
|
||
|
while read -r domain
|
||
|
do
|
||
|
flag=$(echo $domain | gawk '/^[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+(:[0-9]{1,5})?$/{print $0}')
|
||
|
if [ -n "${flag}" ]; then
|
||
|
echo "$domain" >> output.txt
|
||
|
fi
|
||
|
done < data
|
||
|
rm data
|
||
|
|
||
|
mv -f output.txt ../chinalist.txt
|