Use distinct variabled

Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
Christian König 2023-03-07 20:40:16 +01:00
parent d6f5552ccf
commit 309ee78903
No known key found for this signature in database

View file

@ -57,12 +57,12 @@ options=$(sed -E 's/ ?-(all|exact) ?//g' <<< "${options}")
case "${options}" in case "${options}" in
"" ) str="No domain specified";; "" ) str="No domain specified";;
*" "* ) str="Unknown query option specified";; *" "* ) str="Unknown query option specified";;
*[![:ascii:]]* ) domainQuery=$(idn2 "${options}");; *[![:ascii:]]* ) rawDomainQuery=$(idn2 "${options}");;
* ) domainQuery="${options}";; * ) rawDomainQuery="${options}";;
esac esac
# convert the domain to lowercase # convert the domain to lowercase
domainQuery=$(echo "${domainQuery}" | tr '[:upper:]' '[:lower:]') domainQuery=$(echo "${rawDomainQuery}" | tr '[:upper:]' '[:lower:]')
if [[ -n "${str:-}" ]]; then if [[ -n "${str:-}" ]]; then
echo -e "${str}${COL_NC}\\nTry 'pihole -q --help' for more information." echo -e "${str}${COL_NC}\\nTry 'pihole -q --help' for more information."
@ -82,7 +82,7 @@ scanList(){
# /dev/null forces filename to be printed when only one list has been generated # /dev/null forces filename to be printed when only one list has been generated
case "${list_type}" in case "${list_type}" in
"exact" ) grep -i -E -l "(^|(?<!#)\\s)${esc_domain}($|\\s|#)" ${lists} /dev/null 2>/dev/null;; "exact" ) grep -i -E -l "(^|(?<!#)\\s)${esc_domain}($|\\s|#)" "${lists}" /dev/null 2>/dev/null;;
# Iterate through each regexp and check whether it matches the domainQuery # Iterate through each regexp and check whether it matches the domainQuery
# If it does, print the matching regexp and continue looping # If it does, print the matching regexp and continue looping
# Input 1 - regexps | Input 2 - domainQuery # Input 1 - regexps | Input 2 - domainQuery
@ -92,7 +92,7 @@ scanList(){
printf "%b\n" "${list}"; printf "%b\n" "${list}";
fi fi
done;; done;;
* ) grep -i "${esc_domain}" ${lists} /dev/null 2>/dev/null;; * ) grep -i "${esc_domain}" "${lists}" /dev/null 2>/dev/null;;
esac esac
} }