Reformat code

This commit is contained in:
Yifan Gao 2020-06-28 20:41:21 +08:00
parent 6f9976598d
commit 052696c5b5
2 changed files with 20 additions and 20 deletions

View File

@ -3,7 +3,7 @@
[[ $DEBUG == true ]] && set -x
log_info(){
>&2 echo "INFO>" $@
>&2 echo "INFO>" $@
}
get_asn(){
@ -35,21 +35,21 @@ prepare_data_v6(){
log_info "finish bgpdump v6"
}
prepare_data(){
curl -sSL https://bgp.potaroo.net/cidr/autnums.html | awk '-F[<>]' '{print $3,$5}' | grep '^AS' > asnames.txt &
prepare_data_v4 &
prepare_data_v6 &
wait_exit
curl -sSL https://bgp.potaroo.net/cidr/autnums.html | awk '-F[<>]' '{print $3,$5}' | grep '^AS' > asnames.txt &
prepare_data_v4 &
prepare_data_v6 &
wait_exit
}
wait_exit(){
local oldstate=$(set +o)
set +e
local s=0
while [[ $s -ne 127 ]]; do
[[ $s -ne 0 ]] && exit $s
wait -n
s=$?
done
eval "$oldstate"
return 0
local oldstate=$(set +o)
set +e
local s=0
while [[ $s -ne 127 ]]; do
[[ $s -ne 0 ]] && exit $s
wait -n
s=$?
done
eval "$oldstate"
return 0
}

10
stat.sh
View File

@ -5,11 +5,11 @@ cd result
for file in *.txt; do
echo ${file%.*}
if [[ $file == *6.txt ]]; then
#statistics IPv6 /48 blocks
base=48
else
base=32
fi
#statistics IPv6 /48 blocks
base=48
else
base=32
fi
cat $file |
awk -F\/ '{print $2}' |
(