From 490caa13f93e1f4f602731fa7a52a73f8f8c8f36 Mon Sep 17 00:00:00 2001 From: Bohan Yang Date: Sun, 12 May 2019 18:31:10 +0800 Subject: [PATCH] Update --- netboot.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/netboot.sh b/netboot.sh index f372d9c..1202e7b 100644 --- a/netboot.sh +++ b/netboot.sh @@ -25,13 +25,13 @@ echo_stderr() { command_exists() { _PATH="$PATH" PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin" - code=1 - if command -v "$@" >/dev/null 2>&1; then - code=0 - fi + set +e + command -v "$@" >/dev/null 2>&1 + command_exit_status=$? + set -e PATH="$_PATH" unset _PATH - return $code + return $command_exit_status } while [ $# -gt 0 ]; do