From 801047203f00ef6a896e45d9e8976033bcdb7832 Mon Sep 17 00:00:00 2001 From: Nathan Glenn Date: Wed, 20 Sep 2023 18:07:38 -0500 Subject: [PATCH] Better error checking and tracing in bash scripts --- scripts/Eaters.sh | 7 +++++++ scripts/SoarCLI.sh | 7 +++++++ scripts/SoarJavaDebugger.sh | 7 +++++++ scripts/Tanksoar.sh | 7 +++++++ scripts/VisualSoar.sh | 7 +++++++ 5 files changed, 35 insertions(+) diff --git a/scripts/Eaters.sh b/scripts/Eaters.sh index 76ff861..0a1ac41 100755 --- a/scripts/Eaters.sh +++ b/scripts/Eaters.sh @@ -1,5 +1,12 @@ #!/usr/bin/env bash +set -o errexit +set -o nounset +set -o pipefail +if [[ "${TRACE-0}" == "1" ]]; then + set -o xtrace +fi + THISDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) FLAG="" export SOAR_HOME="$THISDIR/bin" diff --git a/scripts/SoarCLI.sh b/scripts/SoarCLI.sh index 0d3b29c..cff2aca 100755 --- a/scripts/SoarCLI.sh +++ b/scripts/SoarCLI.sh @@ -1,5 +1,12 @@ #!/usr/bin/env bash +set -o errexit +set -o nounset +set -o pipefail +if [[ "${TRACE-0}" == "1" ]]; then + set -o xtrace +fi + THISDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) export SOAR_HOME="$THISDIR/bin" export DYLD_LIBRARY_PATH="$SOAR_HOME" diff --git a/scripts/SoarJavaDebugger.sh b/scripts/SoarJavaDebugger.sh index 0f2a56d..82e3cec 100755 --- a/scripts/SoarJavaDebugger.sh +++ b/scripts/SoarJavaDebugger.sh @@ -1,5 +1,12 @@ #!/usr/bin/env bash +set -o errexit +set -o nounset +set -o pipefail +if [[ "${TRACE-0}" == "1" ]]; then + set -o xtrace +fi + THISDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) FLAG="" export SOAR_HOME="$THISDIR/bin" diff --git a/scripts/Tanksoar.sh b/scripts/Tanksoar.sh index 1944749..11f9883 100755 --- a/scripts/Tanksoar.sh +++ b/scripts/Tanksoar.sh @@ -1,5 +1,12 @@ #!/usr/bin/env bash +set -o errexit +set -o nounset +set -o pipefail +if [[ "${TRACE-0}" == "1" ]]; then + set -o xtrace +fi + THISDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) FLAG="" export SOAR_HOME="$THISDIR/bin" diff --git a/scripts/VisualSoar.sh b/scripts/VisualSoar.sh index 1ac01dd..ae954f1 100755 --- a/scripts/VisualSoar.sh +++ b/scripts/VisualSoar.sh @@ -1,5 +1,12 @@ #!/usr/bin/env bash +set -o errexit +set -o nounset +set -o pipefail +if [[ "${TRACE-0}" == "1" ]]; then + set -o xtrace +fi + THISDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) export SOAR_HOME="$THISDIR/bin" export DYLD_LIBRARY_PATH="$SOAR_HOME"