From dd39efdeb769fbb6b1bd58e008a4262b37eb6308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A2=81=E7=A6=8F=E5=85=83?= Date: Fri, 13 Jan 2023 16:40:16 +0800 Subject: [PATCH 1/2] fix-#4057 info: 1. "$@" is a array, we want use string to compare. so update "$@" => "$*" 2. `tty` mean execute the command, we can use $(tty) replace it 3. param $# is a number, compare number should use -gt/-lt,not >/< --- bin/docker-image-tool.sh | 3 +-- bin/kyuubi | 4 ++-- bin/kyuubi-logo | 8 ++++---- bin/stop-application.sh | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/bin/docker-image-tool.sh b/bin/docker-image-tool.sh index e9e4338b5dc..509da0afb24 100755 --- a/bin/docker-image-tool.sh +++ b/bin/docker-image-tool.sh @@ -227,8 +227,7 @@ Examples: EOF } -# shellcheck disable=SC2199 -if [[ "$@" = *--help ]] || [[ "$@" = *-h ]]; then +if [[ "$*" = *--help ]] || [[ "$*" = *-h ]]; then usage exit 0 fi diff --git a/bin/kyuubi b/bin/kyuubi index 414bdeb86ce..b4e0ca37c83 100755 --- a/bin/kyuubi +++ b/bin/kyuubi @@ -30,8 +30,8 @@ function usage() { echo " -h | --help - Show this help message" } -# shellcheck disable=SC2199 -if [[ "$@" = *--help ]] || [[ "$@" = *-h ]]; then + +if [[ "$*" = *--help ]] || [[ "$*" = *-h ]]; then usage exit 0 fi diff --git a/bin/kyuubi-logo b/bin/kyuubi-logo index 15a45a4bbc0..b59a12d8853 100755 --- a/bin/kyuubi-logo +++ b/bin/kyuubi-logo @@ -18,15 +18,15 @@ # Bugzilla 37848: When no TTY is available, don't output to console have_tty=0 -# shellcheck disable=SC2006 -if [[ "`tty`" != "not a tty" ]]; then + +if [[ "$(tty)" != "not a tty" ]]; then have_tty=1 fi # Bugzilla 37848: When no TTY is available, don't output to console have_tty=0 -# shellcheck disable=SC2006 -if [[ "`tty`" != "not a tty" ]]; then + +if [[ "$(tty)" != "not a tty" ]]; then have_tty=1 fi diff --git a/bin/stop-application.sh b/bin/stop-application.sh index b208ab50527..c11815db63a 100755 --- a/bin/stop-application.sh +++ b/bin/stop-application.sh @@ -16,8 +16,8 @@ # limitations under the License. # -# shellcheck disable=SC2071 -if [[ $# < 1 ]] ; then + +if [[ $# -lt 1 ]] ; then echo "USAGE: $0 " exit 1 fi From 86e4e1ce0baccc4ac56c57c6cc580badc55a1203 Mon Sep 17 00:00:00 2001 From: yuan Date: Fri, 13 Jan 2023 16:46:55 +0800 Subject: [PATCH 2/2] fix-#4057 info: modify the shellcheck errors file in ./bin 1. "$@" is a array, we want use string to compare. so update "$@" => "$*" 2. `tty` mean execute the command, we can use $(tty) replace it 3. param $# is a number, compare number should use -gt/-lt,not >/< 4. not sure the /bin/kyuubi line 63 'exit -1' need modify? so the directory bin only have a shellcheck note in /bin/kyuubi --- bin/docker-image-tool.sh | 4 ++-- bin/kyuubi | 4 ++-- bin/kyuubi-logo | 8 ++++---- bin/stop-application.sh | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bin/docker-image-tool.sh b/bin/docker-image-tool.sh index e9e4338b5dc..c9a90cf5782 100755 --- a/bin/docker-image-tool.sh +++ b/bin/docker-image-tool.sh @@ -227,8 +227,8 @@ Examples: EOF } -# shellcheck disable=SC2199 -if [[ "$@" = *--help ]] || [[ "$@" = *-h ]]; then + +if [[ "$*" = *--help ]] || [[ "$*" = *-h ]]; then usage exit 0 fi diff --git a/bin/kyuubi b/bin/kyuubi index 414bdeb86ce..b4e0ca37c83 100755 --- a/bin/kyuubi +++ b/bin/kyuubi @@ -30,8 +30,8 @@ function usage() { echo " -h | --help - Show this help message" } -# shellcheck disable=SC2199 -if [[ "$@" = *--help ]] || [[ "$@" = *-h ]]; then + +if [[ "$*" = *--help ]] || [[ "$*" = *-h ]]; then usage exit 0 fi diff --git a/bin/kyuubi-logo b/bin/kyuubi-logo index 15a45a4bbc0..b59a12d8853 100755 --- a/bin/kyuubi-logo +++ b/bin/kyuubi-logo @@ -18,15 +18,15 @@ # Bugzilla 37848: When no TTY is available, don't output to console have_tty=0 -# shellcheck disable=SC2006 -if [[ "`tty`" != "not a tty" ]]; then + +if [[ "$(tty)" != "not a tty" ]]; then have_tty=1 fi # Bugzilla 37848: When no TTY is available, don't output to console have_tty=0 -# shellcheck disable=SC2006 -if [[ "`tty`" != "not a tty" ]]; then + +if [[ "$(tty)" != "not a tty" ]]; then have_tty=1 fi diff --git a/bin/stop-application.sh b/bin/stop-application.sh index b208ab50527..c11815db63a 100755 --- a/bin/stop-application.sh +++ b/bin/stop-application.sh @@ -16,8 +16,8 @@ # limitations under the License. # -# shellcheck disable=SC2071 -if [[ $# < 1 ]] ; then + +if [[ $# -lt 1 ]] ; then echo "USAGE: $0 " exit 1 fi