Verified Commit 1ebed39d authored by c's avatar c
Browse files

Add `set -o errexit -o nounset` to shell scripts

For #33604
parent 2663148a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -10,7 +10,8 @@ workdir=$(git rev-parse --show-toplevel)

cd "$workdir" || exit 1

set -e
set -o errexit
set -o nounset

if [ -e tests/shellcheck-tests.sh ]; then
    tests/shellcheck-tests.sh
+2 −2
Original line number Diff line number Diff line
#!/bin/sh

# Exit on errors
set -e
set -o errexit
set -o nounset

# SC1117 was disabled after 0.5, because it was too pedantic
EXCLUSIONS="--exclude=SC1117"
+2 −2
Original line number Diff line number Diff line
#!/bin/sh

# Exit on errors
set -e
set -o errexit
set -o nounset

# Output is prefixed with the name of the script
myname=$(basename "$0")
+3 −0
Original line number Diff line number Diff line
@@ -12,6 +12,9 @@
#    network-flavour: one of the files in the networks directory,
#                     (default: 'bridges+hs-v23')

set -o errexit
set -o nounset

# Get a working chutney path
if [ ! -d "$CHUTNEY_PATH" ] || [ ! -x "$CHUTNEY_PATH/chutney" ]; then
    # looks like a broken path: use the path to this tool instead
+3 −0
Original line number Diff line number Diff line
@@ -17,6 +17,9 @@
#    tools/diagnostics.sh
#    tools/diagnostics.sh 001a

set -o errexit
set -o nounset

if [ ! -d "$CHUTNEY_PATH" ] || [ ! -x "$CHUTNEY_PATH/chutney" ]; then
    # looks like a broken path: use the path to this tool instead
    TOOLS_PATH=$(dirname "$0")
Loading