1
0
mirror of https://github.com/octoleo/hosts.git synced 2024-12-28 04:05:00 +00:00

Improve add formatting.

This commit is contained in:
William Melody 2020-04-08 17:27:11 -07:00
parent 902c996b3b
commit 5d9f876b13
8 changed files with 77 additions and 67 deletions

22
hosts
View File

@ -775,6 +775,7 @@ add() {
local _ip="${1:-}"
local _hostname="${2:-}"
local _comment="${*:3}"
local _tabs=$'\t'
if [[ -z "${_ip:-}" ]]
then
@ -786,32 +787,41 @@ add() {
help add
exit 1
elif grep \
-e "^${_ip}\\t${_hostname}$" \
-e "^${_ip}\\t${_hostname}\\t.*$" "${HOSTS_PATH}"
-e "^${_ip}[[:space:]]\+${_hostname}$" \
-e "^${_ip}[[:space:]]\+${_hostname}\\t.*$" "${HOSTS_PATH}"
then
_die printf \
"Duplicate address/host combination, %s unchanged.\\n" \
"${HOSTS_PATH}"
else
if [[ "${#_ip}" -lt 8 ]]
then
_tabs=$'\t\t'
fi
if [[ -n "${_comment:-}" ]]
then
local _formatted_comment
_formatted_comment=$(_join " " "${_comment[@]}")
printf "%s\\t%s\\t# %s\\n" \
printf "%s%s%s\\t# %s\\n" \
"${_ip}" \
"${_tabs}" \
"${_hostname}" \
"${_formatted_comment}" >> "${HOSTS_PATH}"
printf "Added:\\n%s\\t%s\\t# %s\\n" \
printf "Added:\\n%s%s%s\\t# %s\\n" \
"${_ip}" \
"${_tabs}" \
"${_hostname}" \
"${_formatted_comment}"
else
printf "%s\\t%s\\n" \
printf "%s%s%s\\n" \
"${_ip}" \
"${_tabs}" \
"${_hostname}" >> "${HOSTS_PATH}"
printf "Added:\\n%s\\t%s\\n" \
printf "Added:\\n%s%s%s\\n" \
"${_ip}" \
"${_tabs}" \
"${_hostname}"
fi
fi

View File

@ -73,7 +73,7 @@ load test_helper
_compare "${_original}" "$(cat "${HOSTS_PATH}")"
_compare '0.0.0.0 example.com' "$(sed -n '11p' "${HOSTS_PATH}")"
[[ "$(cat "${HOSTS_PATH}")" != "${_original}" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == "0.0.0.0 example.com" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == "0.0.0.0 example.com" ]]
}
@test "\`add <ip> <hostname>\` prints feedback." {
@ -81,7 +81,7 @@ load test_helper
printf "\${status}: %s\\n" "${status}"
printf "\${output}: '%s'\\n" "${output}"
[[ "${lines[0]}" == "Added:" ]]
[[ "${lines[1]}" == "0.0.0.0 example.com" ]]
[[ "${lines[1]}" == "0.0.0.0 example.com" ]]
}
@test "\`add <ip> <hostname>\` doesn't add duplicate entry." {
@ -95,10 +95,10 @@ load test_helper
printf "\${status}: %s\\n" "${status}"
printf "\${output}: '%s'\\n" "${output}"
_compare "${_original}" "$(cat "${HOSTS_PATH}")"
_compare '0.0.0.0 example.com' "$(sed -n '11p' "${HOSTS_PATH}")"
_compare '0.0.0.0 example.com' "$(sed -n '11p' "${HOSTS_PATH}")"
[[ "$(cat "${HOSTS_PATH}")" != "${_original}" ]]
[[ "$(cat "${HOSTS_PATH}")" == "${_modified}" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == "0.0.0.0 example.com" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == "0.0.0.0 example.com" ]]
}
# `hosts add <ip> <hostname> [comment]` #######################################
@ -118,7 +118,7 @@ load test_helper
printf "\${output}: '%s'\\n" "${output}"
[[ "$(cat "${HOSTS_PATH}")" != "${_original}" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == \
"0.0.0.0 example.com # Example multi-word comment." ]]
"0.0.0.0 example.com # Example multi-word comment." ]]
}
@test "\`add <ip> <hostname> [comment]\` doesn't add duplicate entry." {
@ -135,9 +135,9 @@ load test_helper
_compare '0.0.0.0 example.com' "$(sed -n '11p' "${HOSTS_PATH}")"
[[ "$(cat "${HOSTS_PATH}")" != "${_original}" ]]
[[ "$(cat "${HOSTS_PATH}")" == "${_modified}" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == "0.0.0.0 example.com" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == "0.0.0.0 example.com" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" != \
"0.0.0.0 example.com # Example multi-word comment." ]]
"0.0.0.0 example.com # Example multi-word comment." ]]
}
@test "\`add <ip> <hostname> [comment]\` doesn't add duplicate commented entry." {
@ -151,11 +151,11 @@ load test_helper
printf "\${status}: %s\\n" "${status}"
printf "\${output}: '%s'\\n" "${output}"
_compare "${_original}" "$(cat "${HOSTS_PATH}")"
_compare '0.0.0.0 example.com' "$(sed -n '11p' "${HOSTS_PATH}")"
_compare '0.0.0.0 example.com' "$(sed -n '11p' "${HOSTS_PATH}")"
[[ "$(cat "${HOSTS_PATH}")" != "${_original}" ]]
[[ "$(cat "${HOSTS_PATH}")" == "${_modified}" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == \
"0.0.0.0 example.com # Example multi-word comment." ]]
"0.0.0.0 example.com # Example multi-word comment." ]]
}
@test "\`add <ip> <hostname> [comment]\` prints feedback." {
@ -163,7 +163,7 @@ load test_helper
printf "\${status}: %s\\n" "${status}"
printf "\${output}: '%s'\\n" "${output}"
[[ "${lines[0]}" == "Added:" ]]
[[ "${lines[1]}" == "0.0.0.0 example.com # Example multi-word comment." ]]
[[ "${lines[1]}" == "0.0.0.0 example.com # Example multi-word comment." ]]
}
# help ########################################################################

View File

@ -87,7 +87,7 @@ No backups found. Create a new backup:
printf "\${output}: '%s'\\n" "${output}"
printf "\${lines[1]}: '%s'\\n" "${lines[1]}"
[[ ${status} -eq 1 ]]
[[ "${lines[1]}" == '< 0.0.0.0 example.com' ]]
[[ "${lines[1]}" =~ \<\ 0.0.0.0[[:space:]]+example.com ]]
}
@test "\`backups compare\` with missing backup exits with status 1" {

View File

@ -46,7 +46,7 @@ load test_helper
_compare "${_original}" "$(cat "${HOSTS_PATH}")"
_compare '127.0.0.1 example.com' "$(sed -n '11p' "${HOSTS_PATH}")"
[[ "$(cat "${HOSTS_PATH}")" != "${_original}" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == "127.0.0.1 example.com" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" =~ 127.0.0.1[[:space:]]+example.com ]]
}
@test "\`block <hostname>\` prints feedback." {
@ -54,11 +54,11 @@ load test_helper
printf "\${status}: %s\\n" "${status}"
printf "\${output}: '%s'\\n" "${output}"
[[ "${lines[0]}" == "Added:" ]]
[[ "${lines[1]}" == "127.0.0.1 example.com" ]]
[[ "${lines[1]}" =~ 127.0.0.1[[:space:]]+example.com ]]
[[ "${lines[2]}" == "Added:" ]]
[[ "${lines[3]}" == "fe80::1%lo0 example.com" ]]
[[ "${lines[3]}" =~ fe80\:\:1\%lo0[[:space:]]example.com ]]
[[ "${lines[4]}" == "Added:" ]]
[[ "${lines[5]}" == "::1 example.com" ]]
[[ "${lines[5]}" =~ \:\:1[[:space:]]+example.com ]]
}
# `hosts block <hostname> <hostname2>` ########################################
@ -80,8 +80,8 @@ load test_helper
_compare '127.0.0.1 example.com' "$(sed -n '11p' "${HOSTS_PATH}")"
_compare '127.0.0.1 example2.com' "$(sed -n '11p' "${HOSTS_PATH}")"
[[ "$(cat "${HOSTS_PATH}")" != "${_original}" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == "127.0.0.1 example.com" ]]
[[ "$(sed -n '14p' "${HOSTS_PATH}")" == "127.0.0.1 example2.com" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" =~ 127.0.0.1[[:space:]]+example.com ]]
[[ "$(sed -n '14p' "${HOSTS_PATH}")" =~ 127.0.0.1[[:space:]]+example2.com ]]
}
@test "\`block <hostname> <hostname2>\` prints feedback." {
@ -89,17 +89,17 @@ load test_helper
printf "\${status}: %s\\n" "${status}"
printf "\${output}: '%s'\\n" "${output}"
[[ "${lines[0]}" == "Added:" ]]
[[ "${lines[1]}" == "127.0.0.1 example.com" ]]
[[ "${lines[1]}" =~ 127.0.0.1[[:space:]]+example.com ]]
[[ "${lines[2]}" == "Added:" ]]
[[ "${lines[3]}" == "fe80::1%lo0 example.com" ]]
[[ "${lines[3]}" =~ fe80\:\:1\%lo0[[:space:]]+example.com ]]
[[ "${lines[4]}" == "Added:" ]]
[[ "${lines[5]}" == "::1 example.com" ]]
[[ "${lines[5]}" =~ \:\:1[[:space:]]+example.com ]]
[[ "${lines[6]}" == "Added:" ]]
[[ "${lines[7]}" == "127.0.0.1 example2.com" ]]
[[ "${lines[7]}" =~ 127.0.0.1[[:space:]]+example2.com ]]
[[ "${lines[8]}" == "Added:" ]]
[[ "${lines[9]}" == "fe80::1%lo0 example2.com" ]]
[[ "${lines[9]}" =~ fe80\:\:1\%lo0[[:space:]]+example2.com ]]
[[ "${lines[10]}" == "Added:" ]]
[[ "${lines[11]}" == "::1 example2.com" ]]
[[ "${lines[11]}" =~ \:\:1[[:space:]]+example2.com ]]
}
# help ########################################################################

View File

@ -53,8 +53,8 @@ load test_helper
printf "\${status}: %s\\n" "${status}"
printf "\${output}: '%s'\\n" "${output}"
_compare "${_original}" "$(cat "${HOSTS_PATH}")"
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == "#disabled: 0.0.0.0 example.com" ]]
[[ "$(sed -n '12p' "${HOSTS_PATH}")" == "127.0.0.1 example.net" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" =~ \#disabled\:\ 0.0.0.0[[:space:]]+example.com ]]
[[ "$(sed -n '12p' "${HOSTS_PATH}")" =~ 127.0.0.1[[:space:]]+example.net ]]
}
@test "\`disable <ip>\` disables all matches." {
@ -68,8 +68,8 @@ load test_helper
printf "\${status}: %s\\n" "${status}"
printf "\${output}: '%s'\\n" "${output}"
_compare "${_original}" "$(cat "${HOSTS_PATH}")"
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == "#disabled: 0.0.0.0 example.com" ]]
[[ "$(sed -n '12p' "${HOSTS_PATH}")" == "#disabled: 0.0.0.0 example.net" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" =~ \#disabled\:\ 0.0.0.0[[:space:]]+example.com ]]
[[ "$(sed -n '12p' "${HOSTS_PATH}")" =~ \#disabled\:\ 0.0.0.0[[:space:]]+example.net ]]
}
@test "\`disable <ip>\` prints feedback." {
@ -82,7 +82,7 @@ load test_helper
printf "\${status}: %s\\n" "${status}"
printf "\${output}: '%s'\\n" "${output}"
[[ "${lines[0]}" == "Disabling:" ]]
[[ "${lines[1]}" == "0.0.0.0 example.com" ]]
[[ "${lines[1]}" =~ 0.0.0.0[[:space:]]+example.com ]]
}
# `hosts disable <hostname>` ##################################################
@ -110,8 +110,8 @@ load test_helper
printf "\${status}: %s\\n" "${status}"
printf "\${output}: '%s'\\n" "${output}"
_compare "${_original}" "$(cat "${HOSTS_PATH}")"
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == "#disabled: 0.0.0.0 example.com" ]]
[[ "$(sed -n '12p' "${HOSTS_PATH}")" == "127.0.0.1 example.net" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" =~ \#disabled\:\ 0.0.0.0[[:space:]]+example.com ]]
[[ "$(sed -n '12p' "${HOSTS_PATH}")" =~ 127.0.0.1[[:space:]]+example.net ]]
}
@test "\`disable <hostname>\` disables all matches." {
@ -125,8 +125,8 @@ load test_helper
printf "\${status}: %s\\n" "${status}"
printf "\${output}: '%s'\\n" "${output}"
_compare "${_original}" "$(cat "${HOSTS_PATH}")"
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == "#disabled: 0.0.0.0 example.com" ]]
[[ "$(sed -n '12p' "${HOSTS_PATH}")" == "#disabled: 127.0.0.1 example.com" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" =~ \#disabled\:\ 0.0.0.0[[:space:]]+example.com ]]
[[ "$(sed -n '12p' "${HOSTS_PATH}")" =~ 127.0.0.1[[:space:]]+example.com ]]
}
@test "\`disable <hostname>\` prints feedback." {
@ -139,7 +139,7 @@ load test_helper
printf "\${status}: %s\\n" "${status}"
printf "\${output}: '%s'\\n" "${output}"
[[ "${lines[0]}" == "Disabling:" ]]
[[ "${lines[1]}" == "0.0.0.0 example.com" ]]
[[ "${lines[1]}" =~ 0.0.0.0[[:space:]]+example.com ]]
}
# help ########################################################################

View File

@ -58,9 +58,9 @@ load test_helper
printf "\${status}: %s\\n" "${status}"
printf "\${output}: '%s'\\n" "${output}"
_compare "${_original}" "$(cat "${HOSTS_PATH}")"
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == "#disabled: 0.0.0.0 example.com" ]]
[[ "$(sed -n '12p' "${HOSTS_PATH}")" == "#disabled: 0.0.0.0 example.net" ]]
[[ "$(sed -n '13p' "${HOSTS_PATH}")" == "127.0.0.2 example.com" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" =~ \#disabled:\ 0.0.0.0[[:space:]]+example.com ]]
[[ "$(sed -n '12p' "${HOSTS_PATH}")" =~ \#disabled:\ 0.0.0.0[[:space:]]+example.net ]]
[[ "$(sed -n '13p' "${HOSTS_PATH}")" =~ 127.0.0.2[[:space:]]+example.com ]]
}
@test "\`enable <ip>\` enables all matches." {
@ -89,9 +89,9 @@ load test_helper
"'#disabled: 127.0.0.2 example.com'" \
"'$(sed -n '13p' "${HOSTS_PATH}")'"
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == "0.0.0.0 example.com" ]]
[[ "$(sed -n '12p' "${HOSTS_PATH}")" == "0.0.0.0 example.net" ]]
[[ "$(sed -n '13p' "${HOSTS_PATH}")" == "#disabled: 127.0.0.2 example.com" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" =~ 0.0.0.0[[:space:]]+example.com ]]
[[ "$(sed -n '12p' "${HOSTS_PATH}")" =~ 0.0.0.0[[:space:]]+example.net ]]
[[ "$(sed -n '13p' "${HOSTS_PATH}")" =~ \#disabled:\ 127.0.0.2[[:space:]]+example.com ]]
}
@test "\`enable <ip>\` prints feedback." {
@ -106,7 +106,7 @@ load test_helper
printf "\${status}: %s\\n" "${status}"
printf "\${output}: '%s'\\n" "${output}"
[[ "${lines[0]}" == "Enabling:" ]]
[[ "${lines[1]}" == "127.0.0.2 example.com" ]]
[[ "${lines[1]}" =~ 127.0.0.2[[:space:]]+example.com ]]
}
# `hosts enable <hostname>` ###################################################
@ -138,9 +138,9 @@ load test_helper
printf "\${status}: %s\\n" "${status}"
printf "\${output}: '%s'\\n" "${output}"
_compare "${_original}" "$(cat "${HOSTS_PATH}")"
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == "#disabled: 0.0.0.0 example.com" ]]
[[ "$(sed -n '12p' "${HOSTS_PATH}")" == "0.0.0.0 example.net" ]]
[[ "$(sed -n '13p' "${HOSTS_PATH}")" == "127.0.0.2 example.com" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" =~ \#disabled:\ 0.0.0.0[[:space:]]+example.com ]]
[[ "$(sed -n '12p' "${HOSTS_PATH}")" =~ 0.0.0.0[[:space:]]+example.net ]]
[[ "$(sed -n '13p' "${HOSTS_PATH}")" =~ 127.0.0.2[[:space:]]+example.com ]]
}
@test "\`enable <hostname>\` enables all matches." {
@ -169,9 +169,9 @@ load test_helper
"'127.0.0.2 example.com'" \
"'$(sed -n '13p' "${HOSTS_PATH}")'"
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == "0.0.0.0 example.com" ]]
[[ "$(sed -n '12p' "${HOSTS_PATH}")" == "#disabled: 0.0.0.0 example.net" ]]
[[ "$(sed -n '13p' "${HOSTS_PATH}")" == "127.0.0.2 example.com" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" =~ 0.0.0.0[[:space:]]+example.com ]]
[[ "$(sed -n '12p' "${HOSTS_PATH}")" =~ \#disabled:\ 0.0.0.0[[:space:]]+example.net ]]
[[ "$(sed -n '13p' "${HOSTS_PATH}")" =~ 127.0.0.2[[:space:]]+example.com ]]
}
@test "\`enable <hostname>\` prints feedback." {
@ -186,7 +186,7 @@ load test_helper
printf "\${status}: %s\\n" "${status}"
printf "\${output}: '%s'\\n" "${output}"
[[ "${lines[0]}" == "Enabling:" ]]
[[ "${lines[1]}" == "0.0.0.0 example.net" ]]
[[ "${lines[1]}" =~ 0.0.0.0[[:space:]]+example.net ]]
}
# help ########################################################################

View File

@ -83,8 +83,8 @@ load test_helper
printf "\${status}: %s\\n" "${status}"
printf "\${output}: '%s'\\n" "${output}"
_compare "${_original}" "$(cat "${HOSTS_PATH}")"
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == "0.0.0.0 example.com" ]]
[[ "$(sed -n '12p' "${HOSTS_PATH}")" == "0.0.0.0 example.net" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" =~ 0.0.0.0[[:space:]]+example.com ]]
[[ "$(sed -n '12p' "${HOSTS_PATH}")" =~ 0.0.0.0[[:space:]]+example.net ]]
[[ "$(sed -n '13p' "${HOSTS_PATH}")" == "" ]]
}
@ -129,7 +129,7 @@ fe80::1%lo0 localhost
printf "\${status}: %s\\n" "${status}"
printf "\${output}: '%s'\\n" "${output}"
[[ "${lines[0]}" == "Removed:" ]]
[[ "${lines[1]}" == "127.0.0.2 example.com" ]]
[[ "${lines[1]}" =~ 127.0.0.2[[:space:]]+example.com ]]
}
# `hosts remove <hostname> --force` ###########################################
@ -159,7 +159,7 @@ fe80::1%lo0 localhost
printf "\${status}: %s\\n" "${status}"
printf "\${output}: '%s'\\n" "${output}"
_compare "${_original}" "$(cat "${HOSTS_PATH}")"
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == "0.0.0.0 example.net" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" =~ 0.0.0.0[[:space:]]+example.net ]]
[[ "$(sed -n '12p' "${HOSTS_PATH}")" == "" ]]
}
@ -187,8 +187,8 @@ fe80::1%lo0 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
0.0.0.0 example.net
#disabled: 0.0.0.0 example.dev"
0.0.0.0 example.net
#disabled: 0.0.0.0 example.dev"
_compare "'${_expected}'" "'$(cat "${HOSTS_PATH}")'"
[[ "$(cat "${HOSTS_PATH}")" != "${_original}" ]]
[[ "$(cat "${HOSTS_PATH}")" == "${_expected}" ]]
@ -206,7 +206,7 @@ fe80::1%lo0 localhost
printf "\${output}: '%s'\\n" "${output}"
_expected="\
Removed:
0.0.0.0 example.com
0.0.0.0 example.com
127.0.0.2 example.com"
[[ "${output}" == "${_expected}" ]]
}

View File

@ -79,7 +79,7 @@ load test_helper
printf "\${status}: %s\\n" "${status}"
printf "\${output}: '%s'\\n" "${output}"
_compare "${_original}" "$(cat "${HOSTS_PATH}")"
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == "0.0.0.0 example.com" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == "0.0.0.0 example.com" ]]
[[ "$(sed -n '12p' "${HOSTS_PATH}")" == "127.0.0.1 example.net" ]]
[[ "$(sed -n '13p' "${HOSTS_PATH}")" == "" ]]
}
@ -106,7 +106,7 @@ load test_helper
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
0.0.0.0 example.com
0.0.0.0 example.com
127.0.0.1 example.net"
_compare "'${_expected}'" "'$(cat "${HOSTS_PATH}")'"
[[ "$(cat "${HOSTS_PATH}")" != "${_original}" ]]
@ -129,7 +129,7 @@ Removed:
Removed:
fe80::1%lo0 example.com
Removed:
::1 example.com"
::1 example.com"
[[ "${output}" == "${_expected}" ]]
}
@ -162,7 +162,7 @@ Removed:
printf "\${status}: %s\\n" "${status}"
printf "\${output}: '%s'\\n" "${output}"
_compare "${_original}" "$(cat "${HOSTS_PATH}")"
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == "0.0.0.0 example.com" ]]
[[ "$(sed -n '11p' "${HOSTS_PATH}")" == "0.0.0.0 example.com" ]]
[[ "$(sed -n '12p' "${HOSTS_PATH}")" == "127.0.0.1 example.net" ]]
[[ "$(sed -n '13p' "${HOSTS_PATH}")" == "" ]]
}
@ -190,7 +190,7 @@ Removed:
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
0.0.0.0 example.com
0.0.0.0 example.com
127.0.0.1 example.net"
_compare "'${_expected}'" "'$(cat "${HOSTS_PATH}")'"
[[ "$(cat "${HOSTS_PATH}")" != "${_original}" ]]
@ -214,13 +214,13 @@ Removed:
Removed:
fe80::1%lo0 example.com
Removed:
::1 example.com
::1 example.com
Removed:
127.0.0.1 example2.com
Removed:
fe80::1%lo0 example2.com
Removed:
::1 example2.com"
::1 example2.com"
_compare "'${output}'" "'${_expected}'"
diff <(echo "${output}" ) <(echo "${_expected}")
[[ "${output}" == "${_expected}" ]]