mirror of
https://github.com/octoleo/hosts.git
synced 2024-11-25 22:27:42 +00:00
Verify that matching records have been found in remove
before removing
This commit is contained in:
parent
312f5909fa
commit
c2ca24b459
4
hosts
4
hosts
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user