From 1242d0b4bc96ad4d18442536ccc3bb25fd363cf5 Mon Sep 17 00:00:00 2001 From: William Melody Date: Sat, 12 Sep 2015 16:14:36 -0700 Subject: [PATCH] Replace 'domain' with 'hostname' in regular expression variable names. 'hostname' is more accurate and consistent for this context. --- hosts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/hosts b/hosts index cd34db1..74051b3 100755 --- a/hosts +++ b/hosts @@ -732,8 +732,8 @@ disable() { _debug printf "disable() \$search_term: %s\n" "$search_term" target_regex_ip="^\(${search_term}[${_TAB_SPACE_}]..*\)$" - target_regex_commented_domain="^\([^#]..*[${_TAB_SPACE_}]${search_term}[${_TAB_SPACE_}]..*\)$" - target_regex_domain="^\([^#]..*[${_TAB_SPACE_}]${search_term}\)$" + target_regex_commented_hostname="^\([^#]..*[${_TAB_SPACE_}]${search_term}[${_TAB_SPACE_}]..*\)$" + target_regex_hostname="^\([^#]..*[${_TAB_SPACE_}]${search_term}\)$" # Regular Expression Notes # @@ -743,8 +743,8 @@ disable() { targets=$( sed -n \ -e "s/${target_regex_ip}/\1/p" \ - -e "s/${target_regex_commented_domain}/\1/p" \ - -e "s/${target_regex_domain}/\1/p" \ + -e "s/${target_regex_commented_hostname}/\1/p" \ + -e "s/${target_regex_hostname}/\1/p" \ "${HOSTS_PATH}" ) _debug printf "disable() \$targets: %s\n" "$targets" @@ -759,8 +759,8 @@ disable() { # it's optional. More info: http://stackoverflow.com/a/16746032 sed -i '' \ -e "s/${target_regex_ip}/\#disabled: \1/g" \ - -e "s/${target_regex_commented_domain}/\#disabled: \1/g" \ - -e "s/${target_regex_domain}/\#disabled: \1/g" \ + -e "s/${target_regex_commented_hostname}/\#disabled: \1/g" \ + -e "s/${target_regex_hostname}/\#disabled: \1/g" \ "${HOSTS_PATH}" fi } @@ -818,8 +818,8 @@ enable() { _debug printf "enable() \$search_term: %s\n" "$search_term" target_regex_ip="^\#disabled: \(${search_term}[${_TAB_SPACE_}]..*\)$" - target_regex_commented_domain="^\#disabled: \(..*[${_TAB_SPACE_}]${search_term}[${_TAB_SPACE_}]..*\)$" - target_regex_domain="^\#disabled: \(..*[${_TAB_SPACE_}]${search_term}\)$" + target_regex_commented_hostname="^\#disabled: \(..*[${_TAB_SPACE_}]${search_term}[${_TAB_SPACE_}]..*\)$" + target_regex_hostname="^\#disabled: \(..*[${_TAB_SPACE_}]${search_term}\)$" # Regular Expression Notes # @@ -829,8 +829,8 @@ enable() { targets=$( sed -n \ -e "s/${target_regex_ip}/\1/p" \ - -e "s/${target_regex_commented_domain}/\1/p" \ - -e "s/${target_regex_domain}/\1/p" \ + -e "s/${target_regex_commented_hostname}/\1/p" \ + -e "s/${target_regex_hostname}/\1/p" \ "${HOSTS_PATH}" ) _debug printf "enable() \$targets: %s\n" "$targets" @@ -845,8 +845,8 @@ enable() { # it's optional. More info: http://stackoverflow.com/a/16746032 sed -i '' \ -e "s/${target_regex_ip}/\1/g" \ - -e "s/${target_regex_commented_domain}/\1/g" \ - -e "s/${target_regex_domain}/\1/g" \ + -e "s/${target_regex_commented_hostname}/\1/g" \ + -e "s/${target_regex_hostname}/\1/g" \ "${HOSTS_PATH}" fi }