Show only exact matches for pihole -q

This commit is contained in:
DL6ER 2016-12-06 08:18:49 +01:00
parent b6639d9e7e
commit fb72ac9904

4
pihole
View file

@ -71,10 +71,10 @@ queryFunc() {
domain="${2}" domain="${2}"
lists=( /etc/pihole/list.* /etc/pihole/blacklist.txt) lists=( /etc/pihole/list.* /etc/pihole/blacklist.txt)
for list in ${lists[@]}; do for list in ${lists[@]}; do
count=$(grep -c ${domain} $list) count=$(grep -c -E "(^|\s)${domain}($|\s)" $list)
echo "::: ${list} (${count} results)" echo "::: ${list} (${count} results)"
if [[ ${count} > 0 ]]; then if [[ ${count} > 0 ]]; then
grep ${domain} ${list} grep -E "(^|\s)${domain}($|\s)" ${list}
fi fi
echo "" echo ""
done done