From e73b084d20c10d3fc0ec55b94998e952827eb7b2 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sun, 21 Jan 2024 04:58:32 -0800 Subject: [PATCH] Deal with shellcheck warnings in 1988/dale In these scripts, try.sh and try.alt.sh, the warning triggered is entirely incorrect and not a problem so they are now disabled. The comments explain why this is. --- 1988/dale/try.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/1988/dale/try.sh b/1988/dale/try.sh index 132abe136..9b5689add 100755 --- a/1988/dale/try.sh +++ b/1988/dale/try.sh @@ -32,6 +32,14 @@ echo "Why do they differ in the format from the above command? Finally how can y echo "get the more likely desired behaviour?" 1>&2 echo 1>&2 echo 1>&2 +# This warning from ShellCheck is incorrect: +# +# SC2028 (info): echo may not expand escape sequences. Use printf. +# +# because we deliberately have \\n to show that there will be a newline printed +# WITH printf(1). Thus this does show correct output. +# +# shellcheck disable=SC2028 echo "$ ./dale \$(printf "the following files exist in this directory:\\n%s\\n" *)" read -r -n 1 -p "Press any key to continue: " echo 1>&2 @@ -40,6 +48,14 @@ echo 1>&2 ./dale $(printf "the following files exist in this directory:\n%s\n" *) echo 1>&2 +# This warning from ShellCheck is incorrect: +# +# SC2028 (info): echo may not expand escape sequences. Use printf. +# +# because we deliberately have \\n to show that there will be a newline printed +# WITH printf(1). Thus this does show correct output. +# +# shellcheck disable=SC2028 echo "$ ./dale \"\$(printf \"the following files exist in this directory:\\n%s\\n\" *)\"" read -r -n 1 -p "Press any key to continue: " echo 1>&2