Avoid duplicates

This commit is contained in:
Bob Mottram 2015-09-11 22:39:18 +01:00
parent c9ff98c848
commit 939d8f27a1
1 changed files with 5 additions and 2 deletions

View File

@ -134,10 +134,13 @@ while IFS='' read -r line || [[ -n "$line" ]]; do
if [ ${state} -eq "1" ]; then
if [[ $line == *"address ="* ]]; then
address=$(echo $line | awk -F '[' '{print $2}' | awk -F ']' '{print $1}')
echo " http://$peer:$TRACKER_PORT/announce" >> $ZERONET_CONFIG.new
state=0
tracker_url="http://$peer:$TRACKER_PORT/announce"
if ! grep -q "$tracker_url" $ZERONET_CONFIG.new; then
echo " $tracker_url" >> $ZERONET_CONFIG.new
tracker_ctr=$((tracker_ctr + 1))
fi
state=0
fi
fi
if [[ $line == *"hostname ="* ]]; then
peer=$(echo $line | awk -F '[' '{print $2}' | awk -F ']' '{print $1}')