Permalink
Browse files

handle TXT records with double quotes

  • Loading branch information...
1 parent cec433b commit 5898acf3a1f10e0c50aaa3ea28001dddecffa8dc @Geal committed Feb 26, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 dns/dns
View
@@ -38,7 +38,7 @@ else
arr=( $(dig $1 TXT 2>/dev/null) );
for line in "${arr[@]}"; do
regex="^$1.*TXT[[:space:]]*(.*)"
- if [[ "$line" =~ $regex ]] ; then echo ",{\"name\": \"TXT\", \"value\":\"${BASH_REMATCH[1]}\"}"; fi
+ if [[ "$line" =~ $regex ]] ; then txt=$(echo ${BASH_REMATCH[1]} | sed 's/"/\\"/g'); echo ",{\"name\": \"TXT\", \"value\":\"${txt[@]}\"}"; fi
done
echo " ] }";
fi

0 comments on commit 5898acf

Please sign in to comment.