Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/pi-hole/pi-hole.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Schaper <dan.schaper@pi-hole.net>2020-03-02 16:39:21 +0300
committerDan Schaper <dan.schaper@pi-hole.net>2020-03-02 16:39:21 +0300
commit4f390ce801c739ea87cfcae131855ecbd9161818 (patch)
treecbe450c9c79dd01f35ea502254b0213f911a4c0f /advanced
parent58785020bd52c476fe344ce2401a73e4748224ca (diff)
Use bash regex instead of awk.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
Diffstat (limited to 'advanced')
-rwxr-xr-xadvanced/Scripts/query.sh4
1 files changed, 1 insertions, 3 deletions
diff --git a/advanced/Scripts/query.sh b/advanced/Scripts/query.sh
index a96129e0..73650400 100755
--- a/advanced/Scripts/query.sh
+++ b/advanced/Scripts/query.sh
@@ -33,15 +33,13 @@ scanList(){
export LC_CTYPE=C
# /dev/null forces filename to be printed when only one list has been generated
- # shellcheck disable=SC2086
case "${type}" in
"exact" ) grep -i -E -l "(^|(?<!#)\\s)${esc_domain}($|\\s|#)" ${lists} /dev/null 2>/dev/null;;
# Create array of regexps
# Iterate through each regexp and check whether it matches the domainQuery
# If it does, print the matching regexp and continue looping
# Input 1 - regexps | Input 2 - domainQuery
- "regex" ) awk 'NR==FNR{regexps[$0];next}{for (r in regexps)if($0 ~ r)print r}' \
- <(echo "${lists}") <(echo "${domain}") 2>/dev/null;;
+ "regex" ) if [[ "${domain}" =~ ${lists} ]]; then printf "%b\n" "${lists}"; fi;;
* ) grep -i "${esc_domain}" ${lists} /dev/null 2>/dev/null;;
esac
}