From 2511fff2595a5d44e50a1b684acd64cb30876c42 Mon Sep 17 00:00:00 2001 From: Lyndon Brown Date: Wed, 12 Feb 2020 02:40:38 +0000 Subject: [PATCH] don't unnecessarily convert exit codes to strings Closes: #952861 --- functions/arguments.sh | 2 +- functions/chroot.sh | 2 +- functions/echo.sh | 6 +++--- functions/exit.sh | 2 +- scripts/build/config | 3 +-- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/functions/arguments.sh b/functions/arguments.sh index 28e727afb..b2089626c 100755 --- a/functions/arguments.sh +++ b/functions/arguments.sh @@ -12,7 +12,7 @@ Arguments () { ARGUMENTS="$(getopt --longoptions breakpoints,color,conffile:,debug,force,help,quiet,usage,verbose,version --name=${PROGRAM} --options c:huv --shell sh -- "${@}")" - if [ "${?}" != "0" ] + if [ $? -ne 0 ] then Echo_error "terminating" >&2 exit 1 diff --git a/functions/chroot.sh b/functions/chroot.sh index 5d4108708..247d5957b 100755 --- a/functions/chroot.sh +++ b/functions/chroot.sh @@ -34,7 +34,7 @@ Chroot () ${_LINUX32} chroot "${CHROOT}" /usr/bin/env -i HOME="/root" PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" TERM="${TERM}" DEBIAN_FRONTEND="${LB_DEBCONF_FRONTEND}" DEBIAN_PRIORITY="${LB_DEBCONF_PRIORITY}" DEBCONF_NONINTERACTIVE_SEEN="true" DEBCONF_NOWARNINGS="true" ${ENV} ${COMMANDS} - return "${?}" + return ${?} } Chroot_has_package() { diff --git a/functions/echo.sh b/functions/echo.sh index 40e76ea6e..6ec00f867 100755 --- a/functions/echo.sh +++ b/functions/echo.sh @@ -149,11 +149,11 @@ Echo_warning () Echo_status () { - __RETURN="${?}" + __RETURN=$? if [ "${_COLOR}" = "false" ] then - if [ "${__RETURN}" = "0" ] + if [ $__RETURN -eq 0 ] then printf " done.\n" else @@ -162,7 +162,7 @@ Echo_status () else Cursor_columns_backward 8 - if [ "${__RETURN}" = "0" ] + if [ $__RETURN -eq 0 ] then printf " ${GREEN}done${NO_COLOR}. \n" else diff --git a/functions/exit.sh b/functions/exit.sh index 6ff9cdcf7..0ba844ef3 100755 --- a/functions/exit.sh +++ b/functions/exit.sh @@ -10,7 +10,7 @@ Exit () { - VALUE="${?}" + VALUE=$? if [ "${_DEBUG}" = "true" ] then diff --git a/scripts/build/config b/scripts/build/config index 979f3f059..e9328d5a6 100755 --- a/scripts/build/config +++ b/scripts/build/config @@ -166,8 +166,7 @@ Local_arguments () LONG_OPTIONS="$(echo ${LONG_OPTIONS} | tr -d ' ')" ARGUMENTS="$(getopt --longoptions ${LONG_OPTIONS} --name="${PROGRAM}" --options a:d:m:k:b:s:c:huv --shell sh -- "${@}")" - if [ "${?}" != "0" ] - then + if [ $? -ne 0 ]; then Echo_error "terminating" >&2 exit 1 fi