Print table name before entering the loop for the sake of simplicity

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER 2019-05-30 21:44:47 +02:00
parent a904c183df
commit 5060605626
No known key found for this signature in database
GPG key ID: FB60471F0575164A

View file

@ -103,7 +103,7 @@ if [[ -n "${str:-}" ]]; then
fi fi
scanDatabaseTable() { scanDatabaseTable() {
local domain table type querystr result table_prev local domain table type querystr result
domain="$(printf "%q" "${1}")" domain="$(printf "%q" "${1}")"
table="${2}" table="${2}"
type="${3:-}" type="${3:-}"
@ -126,22 +126,20 @@ scanDatabaseTable() {
# Mark domain as having been white-/blacklist matched (global variable) # Mark domain as having been white-/blacklist matched (global variable)
wbMatch=true wbMatch=true
# Loop through each result
# Print table name
if [[ ! -z "${result}" ]]; then
echo " ${matchType^} found in ${COL_BOLD}${table^}${COL_NC}"
fi
# Loop over results and print them
mapfile -t results <<< "${result}" mapfile -t results <<< "${result}"
for result in "${results[@]}"; do for result in "${results[@]}"; do
if [[ -n "${blockpage}" ]]; then if [[ -n "${blockpage}" ]]; then
echo "π ${result}" echo "π ${result}"
exit 0 exit 0
elif [[ -n "${exact}" ]]; then
echo " ${matchType^} found in ${COL_BOLD}${table^}${COL_NC}"
else
# Only print table name once
if [[ ! "${table}" == "${table_prev:-}" ]]; then
echo " ${matchType^} found in ${COL_BOLD}${table^}${COL_NC}"
table_prev="${table}"
fi fi
echo " ${result}" echo " ${result}"
fi
done done
} }