From 3587976f2a8b34c4722caf6920e3a81e38ecf2d6 Mon Sep 17 00:00:00 2001 From: Serghey Rodin Date: Sun, 23 Mar 2014 15:44:30 +0200 Subject: [PATCH] ORiON suggested a better way to check FQDN records --- bin/v-add-dns-record | 3 +-- bin/v-change-dns-record | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/bin/v-add-dns-record b/bin/v-add-dns-record index 78fcfbc6..168200a7 100755 --- a/bin/v-add-dns-record +++ b/bin/v-add-dns-record @@ -39,8 +39,7 @@ if [ "$rtype" != 'MX' ] && [ "$rtype" != 'SRV' ]; then fi # Add trailing dot at the end of NS/CNAME/MX/PTR/SRV record -fqdn_type=$(echo $rtype |grep "NS\|CNAME\|MX\|PTR\|SRV") -if [ ! -z "$fqdn_type" ]; then +if [[ $rtype =~ NS|CNAME|MX|PTR|SRV ]]; then trailing_dot=$(echo $dvalue | grep "\.$") if [ -z $trailing_dot ]; then dvalue="$dvalue." diff --git a/bin/v-change-dns-record b/bin/v-change-dns-record index ace6f985..4f36f1fe 100755 --- a/bin/v-change-dns-record +++ b/bin/v-change-dns-record @@ -54,8 +54,7 @@ if [ "$TYPE" != 'MX' ] && [ "$TYPE" != 'SRV' ]; then fi # Add trailing dot at the end of NS/CNAME/MX/PTR/SRV record -fqdn_type=$(echo $TYPE | grep "NS\|CNAME\|MX\|PTR\|SRV") -if [ ! -z "$fqdn_type" ]; then +if [[ $TYPE =~ NS|CNAME|MX|PTR|SRV ]]; then trailing_dot=$(echo $dvalue | grep "\.$") if [ -z $trailing_dot ]; then dvalue="$dvalue."