[fix] Minor kodev shellscript issues (#4302)

Use `-z` instead of `! -n`.

See https://github.com/koalaman/shellcheck/wiki/SC2236
pull/4303/head
Frans de Jonge 6 years ago committed by GitHub
parent b5911076bc
commit 349485e240
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

16
kodev

@ -3,7 +3,7 @@
CURDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" CURDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
VERSION=$(git describe HEAD) VERSION=$(git describe HEAD)
# Only append date if we're not on a whole version, like v2018.11 # Only append date if we're not on a whole version, like v2018.11
if $VERSION | grep -; then if echo "${VERSION}" | grep -; then
VERSION=${VERSION}_$(git describe HEAD | xargs git show -s --format=format:"%cd" --date=short) VERSION=${VERSION}_$(git describe HEAD | xargs git show -s --format=format:"%cd" --date=short)
fi fi
@ -24,7 +24,7 @@ export NDKABI
function assert_ret_zero() { function assert_ret_zero() {
if [ "${1}" -ne 0 ]; then if [ "${1}" -ne 0 ]; then
if [ ! -z "${2}" ]; then if [ -n "${2}" ]; then
echo "${2}" echo "${2}"
fi fi
exit 1 exit 1
@ -483,7 +483,7 @@ TARGET:
export KODEBUG= export KODEBUG=
;; ;;
--gdb) --gdb)
if [ ! -z "${VALUE}" ]; then if [ -n "${VALUE}" ]; then
gdb=${VALUE} gdb=${VALUE}
else else
# Try to use friendly defaults for gdb # Try to use friendly defaults for gdb
@ -509,7 +509,7 @@ TARGET:
graph_memory=1 graph_memory=1
;; ;;
--valgrind) --valgrind)
if [ ! -z "${VALUE}" ]; then if [ -n "${VALUE}" ]; then
valgrind=${VALUE} valgrind=${VALUE}
else else
# Try to use sensible defaults for valgrind # Try to use sensible defaults for valgrind
@ -526,7 +526,7 @@ TARGET:
;; ;;
-h | --screen-height) -h | --screen-height)
# simple numeric check due to overlap between -h for help and height # simple numeric check due to overlap between -h for help and height
if [ ! -z "${VALUE##*[!0-9]*}" ]; then if [ -n "${VALUE##*[!0-9]*}" ]; then
screen_height=${VALUE} screen_height=${VALUE}
else else
echo "${RUN_HELP_MSG}" echo "${RUN_HELP_MSG}"
@ -622,11 +622,11 @@ TARGET:
KOREADER_COMMAND="${CATCHSEGV} ./reader.lua -d" KOREADER_COMMAND="${CATCHSEGV} ./reader.lua -d"
if [ ! -z "${gdb}" ]; then if [ -n "${gdb}" ]; then
KOREADER_COMMAND="${gdb} ./luajit reader.lua -d" KOREADER_COMMAND="${gdb} ./luajit reader.lua -d"
fi fi
if [ ! -z "${valgrind}" ]; then if [ -n "${valgrind}" ]; then
KOREADER_COMMAND="${valgrind} ./luajit reader.lua -d" KOREADER_COMMAND="${valgrind} ./luajit reader.lua -d"
fi fi
@ -706,7 +706,7 @@ OPTIONS:
test_path="./spec/$1/unit" test_path="./spec/$1/unit"
rm -rf "${test_path}"/data/*.sdr rm -rf "${test_path}"/data/*.sdr
if [ ! -z "${2}" ]; then if [ -n "${2}" ]; then
test_path="${test_path}/$2" test_path="${test_path}/$2"
fi fi

Loading…
Cancel
Save