diff --git a/2000/bmeyer/try.sh b/2000/bmeyer/try.sh index aaa4f6869..ee56ad4fe 100755 --- a/2000/bmeyer/try.sh +++ b/2000/bmeyer/try.sh @@ -19,22 +19,13 @@ clear # be determined: we just use a default value. # # try getting the columns the simple way first: tput cols -COLUMNS="$(tputs cols)" -# In this case we might be able to get away with resolving this ShellCheck -# warning: -# -# SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?. -# -# but we want to assign the value to COLUMNS and at the same time make sure tput -# worked. Thus we disable this warning. -# -# shellcheck disable=SC2181 -if [[ "$?" -ne 0 ]]; then - # if tput failed for any reason try stty(1) with awk(1): +if ! COLUMNS="$(tput cols)"; then + # if tput failed for any reason try stty(1) with awk(1). + # # Disable this warning of shellcheck as it's wrong: awk needs single quotes. # - # SC2016 (info): Expressions don't expand in single quotes, use double quotes for that. - # + # SC2016 (info): Expressions don't expand in single quotes, use double quotes for that. + # https://www.shellcheck.net/wiki/SC2016 # shellcheck disable=SC2016 COLUMNS="$(stty size|awk '{print $NF}')"