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
1 changed files with 9 additions and 11 deletions

View File

@ -103,7 +103,7 @@ if [[ -n "${str:-}" ]]; then
fi
scanDatabaseTable() {
local domain table type querystr result table_prev
local domain table type querystr result
domain="$(printf "%q" "${1}")"
table="${2}"
type="${3:-}"
@ -126,22 +126,20 @@ scanDatabaseTable() {
# Mark domain as having been white-/blacklist matched (global variable)
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}"
for result in "${results[@]}"; do
if [[ -n "${blockpage}" ]]; then
echo "π ${result}"
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
echo " ${result}"
fi
echo " ${result}"
done
}