Add more comments

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER 2019-04-25 12:45:08 +02:00
parent 788cd78321
commit 43bced7997
No known key found for this signature in database
GPG key ID: 00135ACBD90B28DD

View file

@ -24,8 +24,8 @@ listType=""
listname="" listname=""
sqlitekey="" sqlitekey=""
# shellcheck source=/opt/pihole/COL_TABLE colfile="/opt/pihole/COL_TABLE"
source "/opt/pihole/COL_TABLE" source ${colfile}
helpFunc() { helpFunc() {
@ -63,7 +63,7 @@ EscapeRegexp() {
# string in our regular expressions # string in our regular expressions
# This sed is intentionally executed in three steps to ease maintainability # This sed is intentionally executed in three steps to ease maintainability
# The first sed removes any amount of leading dots # The first sed removes any amount of leading dots
echo "$@" | sed 's/^\.*//' | sed "s/[]\.|$(){}?+*^]/\\\\&/g" | sed "s/\\//\\\\\//g" echo $* | sed 's/^\.*//' | sed "s/[]\.|$(){}?+*^]/\\\\&/g" | sed "s/\\//\\\\\//g"
} }
HandleOther() { HandleOther() {
@ -190,8 +190,11 @@ Displaylist() {
# pipe symbols as they are perfectly valid regex filter control characters # pipe symbols as they are perfectly valid regex filter control characters
num_pipes="$(grep -c "^" <<< "$(grep -o "|" <<< "${line}")")" num_pipes="$(grep -c "^" <<< "$(grep -o "|" <<< "${line}")")"
# Extract domain and enabled status based on the obtained number of pipe characters
domain="$(cut -d'|' -f"-$((num_pipes-2))" <<< "${line}")" domain="$(cut -d'|' -f"-$((num_pipes-2))" <<< "${line}")"
enabled="$(cut -d'|' -f$((num_pipes-1)) <<< "${line}")" enabled="$(cut -d'|' -f"$((num_pipes-1))" <<< "${line}")"
# Translate boolean status into human readable string
if [[ "${enabled}" -eq 1 ]]; then if [[ "${enabled}" -eq 1 ]]; then
status="enabled" status="enabled"
else else