From: Ben Crocker <bcrocker@xxxxxxxxxx> SC2039: In POSIX sh, == in place of = is undefined. SC2086: Double quote to prevent globbing and word splitting. Ignore: SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails. Also, change 'if..elif..else..fi' block to case..esac. Signed-off-by: Ben Crocker <bcrocker@xxxxxxxxxx> --- redhat/kabi-dwarf/run_kabi-dw.sh | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/redhat/kabi-dwarf/run_kabi-dw.sh b/redhat/kabi-dwarf/run_kabi-dw.sh index 685a3cd0915a..edb116a98277 100644 --- a/redhat/kabi-dwarf/run_kabi-dw.sh +++ b/redhat/kabi-dwarf/run_kabi-dw.sh @@ -21,10 +21,11 @@ # Usage: # ./run_kabi-dw.sh generate whitelist module_dir kabi_dir # ./run_kabi-dw.sh compare kabi_dir1 kabi_dir2 +# shellcheck disable=SC2164 -DIR=$(dirname ${0}) -DIR=$(cd $DIR; pwd) -PROG=$0 +DIR=$(dirname "$0") +DIR=$(cd "$DIR"; pwd) +PROG="$0" KABIDW=kabi-dw @@ -43,11 +44,11 @@ generate() { SRC=$3 DST=$4 - if [ -d ${DST} ]; then \ - rm -rf ${DST} + if [ -d "$DST" ]; then \ + rm -rf "$DST" fi - ${KABIDW} generate -r -s ${WHITELIST} -o ${DST} ${SRC} + ${KABIDW} generate -r -s "$WHITELIST" -o "$DST" "$SRC" } compare() { @@ -63,10 +64,14 @@ if [ $# -lt 1 ]; then usage fi -if [ $1 == "generate" ]; then - generate $@ -elif [ $1 == "compare" ]; then - compare $@ -else - usage -fi +case "$1" in + generate ) + generate "$@" + ;; + compare ) + compare "$@" + ;; + * ) + usage + ;; +esac -- GitLab _______________________________________________ kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx