Shellcheck is complaining a lot about pihole_adlist_tool
thomasmerz opened this issue · 1 comments
thomasmerz commented
Missing shellcheck compatibility is no fun because there are some severe and critical errors - and this breaks my pipeline because I copied your script in my bin
directory which is shellcheck'ed on every commit:
("passed" now with my changes from PR #37 )
First round:
shellcheck pihole_adlist_tool
pihole_adlist_tool: <stdout>: commitBuffer: invalid argument (invalid character)
In pihole_adlist_tool line 87:
local remote_version="$(
^------------^ SC2155: Declare and assign separately to avoid masking return values.
In pihole_adlist_tool line 125:
local DATE=$(date -d @$1 +%d.%m.%Y%t%k:%M:%S)
^--^ SC2155: Declare and assign separately to avoid masking return values.
^-- SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
local DATE=$(date -d @"$1" +%d.%m.%Y%t%k:%M:%S)
In pihole_adlist_tool line 134:
TIMESTAMP_FIRST_QUERY=$(sqlite $PIHOLE_FTL "SELECT MIN(timestamp) FROM queries;")
^---------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
TIMESTAMP_FIRST_QUERY=$(sqlite "$PIHOLE_FTL" "SELECT MIN(timestamp) FROM queries;")
In pihole_adlist_tool line 135:
TIMESTAMP_LAST_QUERY=$(sqlite $PIHOLE_FTL "SELECT MAX(timestamp) FROM queries;")
^---------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
TIMESTAMP_LAST_QUERY=$(sqlite "$PIHOLE_FTL" "SELECT MAX(timestamp) FROM queries;")
In pihole_adlist_tool line 141:
TIMESTAMP_REQUESTED=$TIMESTAMP_REQUESTED-86400*${DAYS_REQUESTED}
^-- SC2125: Brace expansions and globs are literal in assignments. Quote it or use an array.
In pihole_adlist_tool line 143:
TIMESTAMP_FIRST_ANALYZED=$(sqlite $PIHOLE_FTL "SELECT min(timestamp) FROM queries WHERE timestamp>=$TIMESTAMP_REQUESTED;")
^---------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
TIMESTAMP_FIRST_ANALYZED=$(sqlite "$PIHOLE_FTL" "SELECT min(timestamp) FROM queries WHERE timestamp>=$TIMESTAMP_REQUESTED;")
In pihole_adlist_tool line 149:
DATE_FIRST_QUERY="$(timestamp2date $TIMESTAMP_FIRST_QUERY)"
^--------------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
DATE_FIRST_QUERY="$(timestamp2date "$TIMESTAMP_FIRST_QUERY")"
In pihole_adlist_tool line 150:
DATE_LAST_QUERY="$(timestamp2date $TIMESTAMP_LAST_QUERY)"
^-------------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
DATE_LAST_QUERY="$(timestamp2date "$TIMESTAMP_LAST_QUERY")"
In pihole_adlist_tool line 151:
DATE_REQUESTED="$(timestamp2date $TIMESTAMP_REQUESTED)"
^------------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
DATE_REQUESTED="$(timestamp2date "$TIMESTAMP_REQUESTED")"
In pihole_adlist_tool line 152:
DATE_FIRST_ANALYZED="$(timestamp2date $TIMESTAMP_FIRST_ANALYZED)"
^-----------------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
DATE_FIRST_ANALYZED="$(timestamp2date "$TIMESTAMP_FIRST_ANALYZED")"
In pihole_adlist_tool line 171:
echo " [For more information:
https://www.shellcheck.net/wiki/SC2068 -- Double quote array expansions to ...
https://www.shellcheck.net/wiki/SC2145 -- Argument mixes string and array. ...
https://www.shellcheck.net/wiki/SC2027 -- The surrounding quotes actually u...
After removing "invalid character"(s):
In pihole_adlist_tool line 87:
local remote_version="$(
^------------^ SC2155: Declare and assign separately to avoid masking return values.
In pihole_adlist_tool line 125:
local DATE=$(date -d @$1 +%d.%m.%Y%t%k:%M:%S)
^--^ SC2155: Declare and assign separately to avoid masking return values.
^-- SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
local DATE=$(date -d @"$1" +%d.%m.%Y%t%k:%M:%S)
In pihole_adlist_tool line 134:
TIMESTAMP_FIRST_QUERY=$(sqlite $PIHOLE_FTL "SELECT MIN(timestamp) FROM queries;")
^---------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
TIMESTAMP_FIRST_QUERY=$(sqlite "$PIHOLE_FTL" "SELECT MIN(timestamp) FROM queries;")
In pihole_adlist_tool line 135:
TIMESTAMP_LAST_QUERY=$(sqlite $PIHOLE_FTL "SELECT MAX(timestamp) FROM queries;")
^---------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
TIMESTAMP_LAST_QUERY=$(sqlite "$PIHOLE_FTL" "SELECT MAX(timestamp) FROM queries;")
In pihole_adlist_tool line 141:
TIMESTAMP_REQUESTED=$TIMESTAMP_REQUESTED-86400*${DAYS_REQUESTED}
^-- SC2125: Brace expansions and globs are literal in assignments. Quote it or use an array.
In pihole_adlist_tool line 143:
TIMESTAMP_FIRST_ANALYZED=$(sqlite $PIHOLE_FTL "SELECT min(timestamp) FROM queries WHERE timestamp>=$TIMESTAMP_REQUESTED;")
^---------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
TIMESTAMP_FIRST_ANALYZED=$(sqlite "$PIHOLE_FTL" "SELECT min(timestamp) FROM queries WHERE timestamp>=$TIMESTAMP_REQUESTED;")
In pihole_adlist_tool line 149:
DATE_FIRST_QUERY="$(timestamp2date $TIMESTAMP_FIRST_QUERY)"
^--------------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
DATE_FIRST_QUERY="$(timestamp2date "$TIMESTAMP_FIRST_QUERY")"
In pihole_adlist_tool line 150:
DATE_LAST_QUERY="$(timestamp2date $TIMESTAMP_LAST_QUERY)"
^-------------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
DATE_LAST_QUERY="$(timestamp2date "$TIMESTAMP_LAST_QUERY")"
In pihole_adlist_tool line 151:
DATE_REQUESTED="$(timestamp2date $TIMESTAMP_REQUESTED)"
^------------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
DATE_REQUESTED="$(timestamp2date "$TIMESTAMP_REQUESTED")"
In pihole_adlist_tool line 152:
DATE_FIRST_ANALYZED="$(timestamp2date $TIMESTAMP_FIRST_ANALYZED)"
^-----------------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
DATE_FIRST_ANALYZED="$(timestamp2date "$TIMESTAMP_FIRST_ANALYZED")"
In pihole_adlist_tool line 171:
echo " [i] Of the ${bold}"$NUM_DOMAINS_BLOCKED_CURRENT"${normal} domains that would have been blocked by the adlist configuration you chose to analyze,"
^--------------------------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^--------------------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
echo " [i] Of the ${bold}""$NUM_DOMAINS_BLOCKED_CURRENT""${normal} domains that would have been blocked by the adlist configuration you chose to analyze,"
In pihole_adlist_tool line 172:
echo " ${bold}"$NUM_DOMAINS_BLOCKED_FUTURE"${normal} domains are covered by your current adlist configuration."
^-------------------------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^-------------------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
echo " ${bold}""$NUM_DOMAINS_BLOCKED_FUTURE""${normal} domains are covered by your current adlist configuration."
In pihole_adlist_tool line 184:
docker exec $CONTAINER_ID rm -f $TEMP_DB
^-----------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
docker exec "$CONTAINER_ID" rm -f $TEMP_DB
In pihole_adlist_tool line 205:
docker exec -i $CONTAINER_ID pihole-FTL sqlite3 "$@"
^-----------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
docker exec -i "$CONTAINER_ID" pihole-FTL sqlite3 "$@"
In pihole_adlist_tool line 260:
PIHOLE_DNSMASQ_VERSION=$(docker exec $CONTAINER_ID pihole-FTL -vv |awk '/dnsmasq/{getline; print substr($2,9)}')
^-----------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
PIHOLE_DNSMASQ_VERSION=$(docker exec "$CONTAINER_ID" pihole-FTL -vv |awk '/dnsmasq/{getline; print substr($2,9)}')
In pihole_adlist_tool line 305:
SQLITE_VERSION=$(docker exec $CONTAINER_ID pihole-FTL sqlite3 --version|awk '{print $1}')
^-----------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
SQLITE_VERSION=$(docker exec "$CONTAINER_ID" pihole-FTL sqlite3 --version|awk '{print $1}')
In pihole_adlist_tool line 360:
if [ -n "$remote_version" -a "$remote_version" != "$PIHOLE_ADLIST_TOOL_VERSION" ]; then
^-- SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
In pihole_adlist_tool line 386:
FTL_ID=$(sqlite $PIHOLE_FTL "SELECT MIN(id) FROM queries WHERE timestamp>=$TIMESTAMP_REQUESTED;")
^---------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
FTL_ID=$(sqlite "$PIHOLE_FTL" "SELECT MIN(id) FROM queries WHERE timestamp>=$TIMESTAMP_REQUESTED;")
In pihole_adlist_tool line 394:
echo " [i] ${bold}Warning:${normal} You requested to analyze the last "${DAYS_REQUESTED}" day(s) (starting from "$DATE_REQUESTED"),"
^---------------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^---------------^ SC2086: Double quote to prevent globbing and word splitting.
^-------------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^-------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
echo " [i] ${bold}Warning:${normal} You requested to analyze the last ""${DAYS_REQUESTED}"" day(s) (starting from ""$DATE_REQUESTED""),"
In pihole_adlist_tool line 395:
echo " but last query is from "$DATE_LAST_QUERY""
^--------------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^--------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
echo " but last query is from ""$DATE_LAST_QUERY"""
In pihole_adlist_tool line 404:
echo -e " [i] ${bold}Warning:${normal} You requested to analyze the last "${DAYS_REQUESTED}" days (starting from "$DATE_REQUESTED"),"
^---------------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^---------------^ SC2086: Double quote to prevent globbing and word splitting.
^-------------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^-------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
echo -e " [i] ${bold}Warning:${normal} You requested to analyze the last ""${DAYS_REQUESTED}"" days (starting from ""$DATE_REQUESTED""),"
In pihole_adlist_tool line 405:
echo -e " but oldest query is from "$DATE_FIRST_QUERY". Using this instead\n"
^---------------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^---------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
echo -e " but oldest query is from ""$DATE_FIRST_QUERY"". Using this instead\n"
In pihole_adlist_tool line 411:
adlist_conf_old_enabled=(`sqlite $GRAVITY "select id from adlist where enabled=1;"`)
^-- SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
^-- SC2006: Use $(...) notation instead of legacy backticked `...`.
Did you mean:
adlist_conf_old_enabled=($(sqlite $GRAVITY "select id from adlist where enabled=1;"))
In pihole_adlist_tool line 426:
read -p " Please select: " ENABLE_ALL_ADLISTS_FOR_ANALYSIS
^--^ SC2162: read without -r will mangle backslashes.
In pihole_adlist_tool line 441:
adlist_enabled_in_gravity=(`sqlite $GRAVITY "select distinct adlist_id from gravity;"`)
^-- SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
^-- SC2006: Use $(...) notation instead of legacy backticked `...`.
Did you mean:
adlist_enabled_in_gravity=($(sqlite $GRAVITY "select distinct adlist_id from gravity;"))
In pihole_adlist_tool line 442:
if [ -n "$(echo ${adlist_conf_old_enabled[@]} ${adlist_enabled_in_gravity[@]} | tr ' ' '\n' |sort |uniq -u)" ]; then
^---------------------------^ SC2068: Double quote array expansions to avoid re-splitting elements.
^-----------------------------^ SC2068: Double quote array expansions to avoid re-splitting elements.
In pihole_adlist_tool line 446:
echo " You have ${bold}"${#adlist_conf_old_enabled[@]}"${normal} adlists enabled, but data from ${bold}"${#adlist_enabled_in_gravity[@]}"${normal} (patially different) adlists in your gravity database."
^----------------------------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^-- SC2027: The surrounding quotes actually unquote this. Remove or escape them.
In pihole_adlist_tool line 463:
read -p " Please select: " RUN_GRAVITY_NOW
^--^ SC2162: read without -r will mangle backslashes.
In pihole_adlist_tool line 474:
docker exec $CONTAINER_ID pihole -g
^-----------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
docker exec "$CONTAINER_ID" pihole -g
In pihole_adlist_tool line 513:
docker exec $CONTAINER_ID pihole -g
^-----------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
docker exec "$CONTAINER_ID" pihole -g
In pihole_adlist_tool line 637:
read NUM_DOMAINS_BLOCKED HITS_TOTAL <<<$(sqlite -separator " " $PIHOLE_FTL "SELECT COUNT(DISTINCT domain),count(domain) FROM queries WHERE id>=${FTL_ID} AND status in (1,9);")
^--^ SC2162: read without -r will mangle backslashes.
^-- SC2046: Quote this to prevent word splitting.
^---------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
read NUM_DOMAINS_BLOCKED HITS_TOTAL <<<$(sqlite -separator " " "$PIHOLE_FTL" "SELECT COUNT(DISTINCT domain),count(domain) FROM queries WHERE id>=${FTL_ID} AND status in (1,9);")
In pihole_adlist_tool line 650:
echo " [i] You have ${bold}"$NUM_ADLISTS" adlists${normal} configured ("$NUM_ADLISTS_ENABLED" enabled)"
^----------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^----------^ SC2086: Double quote to prevent globbing and word splitting.
^------------------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^------------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
echo " [i] You have ${bold}""$NUM_ADLISTS"" adlists${normal} configured (""$NUM_ADLISTS_ENABLED"" enabled)"
In pihole_adlist_tool line 651:
echo " [i] Your gravity.db contains ${bold}"$NUM_GRAVITY_UNIQUE_DOMAINS" unique domains${normal}"
^-------------------------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^-------------------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
echo " [i] Your gravity.db contains ${bold}""$NUM_GRAVITY_UNIQUE_DOMAINS"" unique domains${normal}"
In pihole_adlist_tool line 652:
echo " [i] Since "$DATE_FIRST_ANALYZED" ${bold}"$NUM_DOMAINS_BLOCKED" different domains${normal} from your adlists have been blocked ${bold}"$HITS_TOTAL" times${normal} in total"
^------------------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^------------------^ SC2086: Double quote to prevent globbing and word splitting.
^------------------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^------------------^ SC2086: Double quote to prevent globbing and word splitting.
^---------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^---------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
echo " [i] Since ""$DATE_FIRST_ANALYZED"" ${bold}""$NUM_DOMAINS_BLOCKED"" different domains${normal} from your adlists have been blocked ${bold}""$HITS_TOTAL"" times${normal} in total"
In pihole_adlist_tool line 654:
echo " [i] Using you current adlist configuration ${bold}"$NUM_DOMAINS_BLOCKED_CURRENT" domains${normal} would have been blocked ${bold}"$HITS_TOTAL_CURRENT" times${normal}"
^--------------------------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^--------------------------^ SC2086: Double quote to prevent globbing and word splitting.
^-----------------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^-----------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
echo " [i] Using you current adlist configuration ${bold}""$NUM_DOMAINS_BLOCKED_CURRENT"" domains${normal} would have been blocked ${bold}""$HITS_TOTAL_CURRENT"" times${normal}"
In pihole_adlist_tool line 706:
echo " Those would have been the ${bold}"$TOP" top blocked adlist domains${normal} since "$DATE_FIRST_ANALYZED""
^--^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^--^ SC2086: Double quote to prevent globbing and word splitting.
^------------------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^------------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
echo " Those would have been the ${bold}""$TOP"" top blocked adlist domains${normal} since ""$DATE_FIRST_ANALYZED"""
In pihole_adlist_tool line 709:
sqlite -column -header $TEMP_DB "SELECT domain, hits FROM blocked_domains LIMIT "${TOP}";"
^----^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^----^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
sqlite -column -header $TEMP_DB "SELECT domain, hits FROM blocked_domains LIMIT ""${TOP}"";"
In pihole_adlist_tool line 735:
echo " [i] In total your adlists contain ${bold}"$NUM_TOTAL_UNIQUE_DOMAINS" visited (covered) unique domains${normal} - meaning those domains are contained only in a single adlist. "
^-----------------------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^-----------------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
echo " [i] In total your adlists contain ${bold}""$NUM_TOTAL_UNIQUE_DOMAINS"" visited (covered) unique domains${normal} - meaning those domains are contained only in a single adlist. "
In pihole_adlist_tool line 756:
read -p " Please select: " FURTHER_ACTION
^--^ SC2162: read without -r will mangle backslashes.
In pihole_adlist_tool line 773:
read -p " Please select: " FURTHER_ACTION
^--^ SC2162: read without -r will mangle backslashes.
In pihole_adlist_tool line 792:
adlist_conf_unique_enabled=(`sqlite $TEMP_DB "select id from adlist where unique_domains_covered IS NOT NULL;"`)
^-- SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
^-- SC2006: Use $(...) notation instead of legacy backticked `...`.
Did you mean:
adlist_conf_unique_enabled=($(sqlite $TEMP_DB "select id from adlist where unique_domains_covered IS NOT NULL;"))
In pihole_adlist_tool line 807:
docker exec $CONTAINER_ID pihole restartdns reload-lists
^-----------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
docker exec "$CONTAINER_ID" pihole restartdns reload-lists
In pihole_adlist_tool line 836:
adlist_conf_minimal_enabled=(`sqlite $TEMP_DB "select id from adlist where unique_domains_covered IS NOT NULL;"`)
^-- SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
^-- SC2006: Use $(...) notation instead of legacy backticked `...`.
Did you mean:
adlist_conf_minimal_enabled=($(sqlite $TEMP_DB "select id from adlist where unique_domains_covered IS NOT NULL;"))
In pihole_adlist_tool line 844:
LEFT_DOMAINS=(`sqlite $TEMP_DB "SELECT COUNT (domain) from gravity_dup;"`)
^-- SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
^-- SC2006: Use $(...) notation instead of legacy backticked `...`.
Did you mean:
LEFT_DOMAINS=($(sqlite $TEMP_DB "SELECT COUNT (domain) from gravity_dup;"))
In pihole_adlist_tool line 846:
while [[ $LEFT_DOMAINS != [0] ]]; do
^-----------^ SC2128: Expanding an array without an index only gives the first element.
In pihole_adlist_tool line 847:
current_id=(`sqlite $TEMP_DB "Select adlist_id from gravity_dup group by adlist_id order by count (domain) desc, adlist_id asc limit 1;"`);
^-- SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
^-- SC2006: Use $(...) notation instead of legacy backticked `...`.
Did you mean:
current_id=($(sqlite $TEMP_DB "Select adlist_id from gravity_dup group by adlist_id order by count (domain) desc, adlist_id asc limit 1;"));
In pihole_adlist_tool line 849:
adlist_conf_minimal_enabled[${#adlist_conf_minimal_enabled[@]}]="$current_id"
^---------^ SC2128: Expanding an array without an index only gives the first element.
In pihole_adlist_tool line 850:
sqlite $TEMP_DB "DELETE FROM gravity_dup WHERE domain IN (SELECT domain from gravity_dup where adlist_id=$current_id);"
^---------^ SC2128: Expanding an array without an index only gives the first element.
In pihole_adlist_tool line 851:
LEFT_DOMAINS=(`sqlite $TEMP_DB "SELECT COUNT (domain) from gravity_dup;"`)
^-- SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
^-- SC2006: Use $(...) notation instead of legacy backticked `...`.
Did you mean:
LEFT_DOMAINS=($(sqlite $TEMP_DB "SELECT COUNT (domain) from gravity_dup;"))
In pihole_adlist_tool line 855:
echo " [i] Enabling adlists with id ${adlist_conf_minimal_enabled[@]}"
^-- SC2145: Argument mixes string and array. Use * or separate argument.
In pihole_adlist_tool line 871:
docker exec $CONTAINER_ID pihole restartdns reload-lists
^-----------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
docker exec "$CONTAINER_ID" pihole restartdns reload-lists
In pihole_adlist_tool line 908:
docker exec $CONTAINER_ID pihole restartdns reload-lists
^-----------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
docker exec "$CONTAINER_ID" pihole restartdns reload-lists
In pihole_adlist_tool line 984:
all_domains=(`sqlite $TEMP_DB "SELECT domain FROM all_domains"`)
^-- SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
^-- SC2006: Use $(...) notation instead of legacy backticked `...`.
Did you mean:
all_domains=($(sqlite $TEMP_DB "SELECT domain FROM all_domains"))
In pihole_adlist_tool line 987:
pihole-FTL regex-test $CURRENT_DOMAIN |grep -E -o "DB ID [0-9]*"|awk '{print $3}' | while read REGEX_ID; do
^-------------^ SC2086: Double quote to prevent globbing and word splitting.
^--^ SC2162: read without -r will mangle backslashes.
Did you mean:
pihole-FTL regex-test "$CURRENT_DOMAIN" |grep -E -o "DB ID [0-9]*"|awk '{print $3}' | while read REGEX_ID; do
In pihole_adlist_tool line 1003:
all_exact_domains=(`sqlite $GRAVITY "SELECT domain FROM domainlist WHERE type in (0,1);"`)
^-- SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
^-- SC2006: Use $(...) notation instead of legacy backticked `...`.
Did you mean:
all_exact_domains=($(sqlite $GRAVITY "SELECT domain FROM domainlist WHERE type in (0,1);"))
In pihole_adlist_tool line 1006:
pihole-FTL regex-test $CURRENT_DOMAIN |grep -E -o "DB ID [0-9]*"|awk '{print $3}' | while read REGEX_ID; do
^-------------^ SC2086: Double quote to prevent globbing and word splitting.
^--^ SC2162: read without -r will mangle backslashes.
Did you mean:
pihole-FTL regex-test "$CURRENT_DOMAIN" |grep -E -o "DB ID [0-9]*"|awk '{print $3}' | while read REGEX_ID; do
In pihole_adlist_tool line 1036:
echo " [i] Since "$DATE_FIRST_ANALYZED" you have been visiting ${bold}"$NUM_ALL_DOMAINS" different domains${normal}."
^------------------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^------------------^ SC2086: Double quote to prevent globbing and word splitting.
^--------------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^--------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
echo " [i] Since ""$DATE_FIRST_ANALYZED"" you have been visiting ${bold}""$NUM_ALL_DOMAINS"" different domains${normal}."
In pihole_adlist_tool line 1037:
echo " You have ${bold}"$NUM_REGEX" blacklist RegEx${normal} configured ("$NUM_ENABLED_REGEX" enabled)"
^--------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^--------^ SC2086: Double quote to prevent globbing and word splitting.
^----------------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^----------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
echo " You have ${bold}""$NUM_REGEX"" blacklist RegEx${normal} configured (""$NUM_ENABLED_REGEX"" enabled)"
In pihole_adlist_tool line 1038:
echo " With your enabled blacklist RegEx you would have covered ${bold}"$NUM_DOMAINS_BLOCKED_BY_REGEX" different domains${normal}."
^---------------------------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^---------------------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
echo " With your enabled blacklist RegEx you would have covered ${bold}""$NUM_DOMAINS_BLOCKED_BY_REGEX"" different domains${normal}."
In pihole_adlist_tool line 1055:
echo " ${bold}"$NUM_DOMAINLIST_REGEX" distinct domain(s)${normal} from your domainlist are covered by your RegEx."
^-------------------^ SC2027: The surrounding quotes actually unquote this. Remove or escape them.
^-------------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
echo " ${bold}""$NUM_DOMAINLIST_REGEX"" distinct domain(s)${normal} from your domainlist are covered by your RegEx."
For more information:
https://www.shellcheck.net/wiki/SC2068 -- Double quote array expansions to ...
https://www.shellcheck.net/wiki/SC2145 -- Argument mixes string and array. ...
https://www.shellcheck.net/wiki/SC2027 -- The surrounding quotes actually u...
If I find the time, I will shellcheck this and open a PR… But if another person has the time and fun to shellcheck this - let's go, and leave an update here! 👍🏻
yubiuser commented