From c93f53b463ade5bf2d6af9918989067ccb30df21 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 3 Aug 2018 00:14:50 +0000 Subject: [PATCH] test-all: Fix shellcheck warnings. In tools/test-all line 7: TEMP=`getopt -o f --long force -- "$@"` ^-- SC2006: Use $(..) instead of legacy `..`. In tools/test-all line 24: echo "Running $@" ^-- SC2145: Argument mixes string and array. Use * or separate argument. In tools/test-all line 26: printf "\n\e[31;1mFAILED\e[0m $@\n" ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo". ^-- SC1117: Backslash is literal in "\n". Prefer explicit escaping: "\\n". ^-- SC1117: Backslash is literal in "\e". Prefer explicit escaping: "\\e". ^-- SC1117: Backslash is literal in "\e". Prefer explicit escaping: "\\e". ^-- SC2145: Argument mixes string and array. Use * or separate argument. ^-- SC1117: Backslash is literal in "\n". Prefer explicit escaping: "\\n". Signed-off-by: Anders Kaseorg --- tools/test-all | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/test-all b/tools/test-all index 09125e6392..a92942e12e 100755 --- a/tools/test-all +++ b/tools/test-all @@ -4,7 +4,7 @@ set -e cd "$(dirname "$0")"/.. # read the options -TEMP=`getopt -o f --long force -- "$@"` +TEMP=$(getopt -o f --long force -- "$@") eval set -- "$TEMP" # extract options. @@ -21,9 +21,13 @@ done function run { echo '----' - echo "Running $@" + printf 'Running' + printf ' %q' "$@" + printf '\n' if ! "$@"; then - printf "\n\e[31;1mFAILED\e[0m $@\n" + printf '\n\e[31;1mFAILED\e[0m' + printf ' %q' "$@" + printf '\n' exit 1 else echo