From 5060605626950007aa0fc35153356ea49c96a187 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 30 May 2019 21:44:47 +0200 Subject: [PATCH] Print table name before entering the loop for the sake of simplicity Signed-off-by: DL6ER --- advanced/Scripts/query.sh | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/advanced/Scripts/query.sh b/advanced/Scripts/query.sh index d2e16e79..88ec2173 100755 --- a/advanced/Scripts/query.sh +++ b/advanced/Scripts/query.sh @@ -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 }