Grep was leaking a file not found if blacklist didn't exist

This commit is contained in:
Eric Warnke 2016-10-28 17:28:04 -04:00
parent e22aca49c8
commit 3da75d6125
1 changed files with 2 additions and 2 deletions

View File

@ -82,7 +82,7 @@ AddDomain() {
bool=true bool=true
#Is the domain in the list we want to add it to? #Is the domain in the list we want to add it to?
grep -Ex -q "$1" ${list} || bool=false grep -Ex -q "$1" ${list} > /dev/null 2>&1 || bool=false
if [[ "${bool}" == false ]]; then if [[ "${bool}" == false ]]; then
#domain not found in the whitelist file, add it! #domain not found in the whitelist file, add it!
@ -104,7 +104,7 @@ RemoveDomain() {
bool=true bool=true
#Is it in the other list? Logic follows that if its whitelisted it should not be blacklisted and vice versa #Is it in the other list? Logic follows that if its whitelisted it should not be blacklisted and vice versa
grep -Ex -q "$1" ${list} || bool=false grep -Ex -q "$1" ${list} > /dev/null 2>&1 || bool=false
if [[ "${bool}" == true ]]; then if [[ "${bool}" == true ]]; then
# Remove it from the other one # Remove it from the other one
echo "::: Removing $1 from $list..." echo "::: Removing $1 from $list..."