From: Chris Koeritz Date: Wed, 15 Nov 2017 04:00:07 +0000 (-0500) Subject: named.conf.local being processed right X-Git-Tag: 2.140.100^2~11^2~12 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=3d0aa2a3d1c91490f83148d66e0078807b46944a;p=feisty_meow.git named.conf.local being processed right --- diff --git a/scripts/system/common_sysadmin.sh b/scripts/system/common_sysadmin.sh index 76260918..4bd9859a 100644 --- a/scripts/system/common_sysadmin.sh +++ b/scripts/system/common_sysadmin.sh @@ -87,19 +87,19 @@ var filename seeker numlines # don't bother looking at the lines if we're already in skip mode. if [[ $skip_count == 0 ]]; then # find the string they're seeking. - if [[ ! $line =~ *${seeker}* ]]; then + if [[ ! "$line" =~ .*${seeker}.* ]]; then # no match. echo "$line" >> "$new_version" else # a match! start skipping. we will delete this line and the next N lines. - $((skip_count++)) + ((skip_count++)) echo first skip count is now $skip_count fi else # we're already skipping. let's keep going until we hit the limit. - $((skip_count++)) + ((skip_count++)) echo ongoing skip count is now $skip_count - if (( $skip_count >= $numlines )); then + if (( $skip_count > $numlines )); then echo "Done skipping, and back to writing output file." skip_count=0 fi @@ -127,7 +127,7 @@ function remove_zone_for_domain() # eat the zone file definition. this will botch up badly if more text was added # or the zone info shrank. - create_chomped_copy_of_file "/etc/bind/named.conf.local" "zone*${domain_name}" 6 + create_chomped_copy_of_file "/etc/bind/named.conf.local" "zone.*${domain_name}" 6 # \cp -f "$domain_file" "$domain_file.bkup-${RANDOM}" # test_or_die "backing up domain file: $domain_file" @@ -229,7 +229,7 @@ function remove_subdomain() fi create_chomped_copy_of_file "$domain_file" \ - "${subdomain}*${containing_domain}*IN*A*${IP_ADDRESS}" 1 + "${subdomain}.*${containing_domain} *IN *A *${IP_ADDRESS}" 1 } # adds a new subdomain under a containing domain.