1
0
mirror of https://github.com/octoleo/hosts.git synced 2024-11-22 04:45:11 +00:00

Verify that matching records have been found in remove before removing

This commit is contained in:
William Melody 2015-03-20 18:10:51 -07:00
parent 312f5909fa
commit c2ca24b459

4
hosts
View File

@ -789,6 +789,10 @@ remove() {
exit 1
else
local target_records=$(sed -n "s/^\(.*${search_string}.*\)$/\1/p" "${HOSTS_PATH}")
if [[ -z ${target_records:-} ]]; then
printf "No matching records found.\n"
exit 1
fi
if ! _command_argv_includes "--force"; then
printf "Removing the following records:\n%s\n" "$target_records"
while true; do