From cdc7212e1b0b25fedd0777fe52edea5b8c7acfc3 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sun, 21 Jan 2024 05:13:44 -0800 Subject: [PATCH] Deal with shellcheck warnings in 1995/garry --- 1995/garry/try.alt.sh | 9 ++++++++- 1995/garry/try.sh | 12 +++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/1995/garry/try.alt.sh b/1995/garry/try.alt.sh index 29d812912..3fa9e91b9 100755 --- a/1995/garry/try.alt.sh +++ b/1995/garry/try.alt.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash # # try.alt.sh - demonstrate IOCCC winner 1995/garry alt code # @@ -15,6 +15,13 @@ make CC="$CC" alt >/dev/null || exit 1 # clear screen after compilation so that only the entry is shown clear +# This warning from ShellCheck is incorrect: +# +# SC2028 (info): echo may not expand escape sequences. Use printf. +# +# because we don't want them to be expanded. This does show correct output. +# +# shellcheck disable=SC2028 echo "$ EXAMPLEON=\"\33\133\61\73\67\155\"; EXAMPLEOFF=\"\33\133\155\"; DOLLAR=\"$\"" 1>&2 EXAMPLEON="\33\133\61\73\67\155" EXAMPLEOFF="\33\133\155" diff --git a/1995/garry/try.sh b/1995/garry/try.sh index 1d3175889..e5548f933 100755 --- a/1995/garry/try.sh +++ b/1995/garry/try.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash # # try.sh - demonstrate IOCCC winner 1995/garry # @@ -15,8 +15,14 @@ make CC="$CC" all >/dev/null || exit 1 # clear screen after compilation so that only the entry is shown clear - -echo "$ EXAMPLEON=\"\33\133\61\73\67\155\"; EXAMPLEOFF=\"\33\133\155\"; DOLLAR=\"$\"" 1>&2 +# This warning from ShellCheck is incorrect: +# +# SC2028 (info): echo may not expand escape sequences. Use printf. +# +# because we don't want them to be expanded. This does show correct output. +# +# shellcheck disable=SC2028 +echo "$ EXAMPLEON=\"\\33\133\61\73\67\155\"; EXAMPLEOFF=\"\33\133\155\"; DOLLAR=\"$\"" 1>&2 EXAMPLEON="\33\133\61\73\67\155" EXAMPLEOFF="\33\133\155" DOLLAR="$"