Experimental output of matching line from shown warnings.

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER 2020-02-21 21:41:28 +01:00
parent 839fe32042
commit 3c09cd4a3a
No known key found for this signature in database
GPG key ID: FB60471F0575164A

View file

@ -391,7 +391,29 @@ gravity_DownloadBlocklists() {
fi
if [[ "${status}" -eq 0 && -n "${output}" ]]; then
echo -e " Encountered non-critical SQL warnings. Please check the suitability of the list you're using!\\nSQL warnings:\\n${output}\\n"
echo -e " Encountered non-critical SQL warnings. Please check the suitability of the lists you're using!\\n\\n SQL warnings:"
local warning file line lineno
while IFS= read -r line; do
echo " - ${line}"
warning="$(grep -oh "^[^:]*:[0-9]*" <<< "${line}")"
file="${warning%:*}"
lineno="${warning#*:}"
if [[ -n "${file}" && -n "${lineno}" ]]; then
echo -n " Line contains: "
awk "NR==${lineno}" < ${file}
fi
done <<< "${output}"
echo ""
local file line
while IFS= read -r line; do
warning="$(grep -oh "^[^:]*:[0-9]*" <<< "${line}")"
file="${warning%:*}"
lineno="${warning#*:}"
if [[ -n "${file}" && -n "${lineno}" ]]; then
echo -n "Line contains: "
awk "NR==${lineno}" < ${file}
fi
done <<< "${output}"
fi
rm "${target}" > /dev/null 2>&1 || \