diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-04-20 23:24:27 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2017-04-20 23:24:27 -0400 |
commit | 3a18b5e8cf50b688f3c6e0ffbaaa1c70cf09f484 (patch) | |
tree | 2e43af5a1660bf255ee18036e7e13e2fc0a59976 | |
parent | cdc456c8b7c6e3eb4b11d668fb9c6e9bdec7230e (diff) |
Use "$?" more sparingly.
-rwxr-xr-x | src/is_built | 5 | ||||
-rwxr-xr-x | src/librefetch/librefetch | 9 | ||||
-rwxr-xr-x | src/xbs-abslibre/helper-abslibre | 2 |
3 files changed, 7 insertions, 9 deletions
diff --git a/src/is_built b/src/is_built index 7e4a005..d8a0eb1 100755 --- a/src/is_built +++ b/src/is_built @@ -51,10 +51,9 @@ fi pkg=${1} ver=${2:-0} -pver=$(LC_ALL=C pacman -Sddp --print-format '%v' "${pkg}" 2>/dev/null) -# if pacman fails or returns nothing -r=$? +r=0 +pver=$(LC_ALL=C pacman -Sddp --print-format '%v' "${pkg}" 2>/dev/null) || r=$? result=$(vercmp "${pver}" "${ver}") # result: diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch index 855719d..bba7df9 100755 --- a/src/librefetch/librefetch +++ b/src/librefetch/librefetch @@ -213,9 +213,9 @@ doit() { if [[ $base_dst == *.sig ]]; then if ! [[ -e $base_dst ]]; then extra_opts=("${src%.sig}" "${base_dst%.sig}") - doit || exit $? + doit || exit fi - create_signature "${base_dst%.sig}" || exit $? + create_signature "${base_dst%.sig}" || exit if [[ -n $suffix ]]; then mv -f "$base_dst" "$dst" fi @@ -225,7 +225,7 @@ doit() { export pkg_file=$dst cd "$BUILDFILEDIR" - "$makepkg" "${makepkg_opts[@]}" -p "$srcbuild" >&2 || exit $? + "$makepkg" "${makepkg_opts[@]}" -p "$srcbuild" >&2 || exit fi fi } @@ -252,8 +252,7 @@ parse_options() { # Feed the options through getopt (sanitize them) local shrt="$({ printf '%s\0' "${shrt1[@]}"; printf '%s:\0' "${shrt2[@]}"; } | sort -zu | xargs -0 printf '%s')" local long="$({ printf '%s\0' "${long1[@]}"; printf '%s:\0' "${long2[@]}"; } | sort -zu | xargs -0 printf '%s,')" - local args="$(getopt -n "$cmd" -o "$shrt" -l "${long%,}" -- "$@")" - ret=$? + local args="$(getopt -n "$cmd" -o "$shrt" -l "${long%,}" -- "$@")" || ret=$? eval set -- "$args" unset shrt long args diff --git a/src/xbs-abslibre/helper-abslibre b/src/xbs-abslibre/helper-abslibre index eab37cd..3d3be9a 100755 --- a/src/xbs-abslibre/helper-abslibre +++ b/src/xbs-abslibre/helper-abslibre @@ -199,6 +199,6 @@ name() { } case "$1" in - status|download|release-client|release-server|unrelease|move|releasepath|name) "$@" || exit $?;; + status|download|release-client|release-server|unrelease|move|releasepath|name) "$@" || exit;; *) exit 127;; esac |