From e1d770d4517c2b7a570e98c7d3658d0789488780 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 3 Aug 2018 00:14:50 +0000 Subject: [PATCH] test-documentation: Fix shellcheck warnings. In tools/test-documentation line 6: echo -e "\e[${color_code}m${message}\e[0m" >&2 ^-- SC1117: Backslash is literal in "\e". Prefer explicit escaping: "\\e". ^-- SC1117: Backslash is literal in "\e". Prefer explicit escaping: "\\e". In tools/test-documentation line 41: scrapy crawl_with_status documentation_crawler $loglevel ^-- SC2086: Double quote to prevent globbing and word splitting. Signed-off-by: Anders Kaseorg --- tools/test-documentation | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/test-documentation b/tools/test-documentation index 3d361bcf1e..900ee7b493 100755 --- a/tools/test-documentation +++ b/tools/test-documentation @@ -3,9 +3,11 @@ set -e color_message () { local color_code="$1" message="$2" - echo -e "\e[${color_code}m${message}\e[0m" >&2 + printf '\e[%sm%s\e[0m\n' "$color_code" "$message" >&2 } +loglevel=() + case $1 in -h|--help) echo "--help, -h show this help message and exit" @@ -13,7 +15,7 @@ case $1 in exit 0 ;; -L|--loglevel) - loglevel="$1 $2" + loglevel=("$1" "$2") ;; --skip-check-links) skip_check_links=1 @@ -38,7 +40,7 @@ color_message 94 "Testing links in documentation..." cd ../tools/documentation_crawler set +e -scrapy crawl_with_status documentation_crawler $loglevel +scrapy crawl_with_status documentation_crawler "${loglevel[@]}" result=$? if [ "$result" = 1 ]; then color_message 91 "Failed!"