From e0650572f27fdb2abc37fc0f2e9ada2cc539f4d1 Mon Sep 17 00:00:00 2001 From: Ben Nemec Date: Fri, 11 Apr 2014 19:39:50 -0500 Subject: [PATCH] Ensure scripts are set -u This will hopefully catch bugs where they happen rather than allowing scripts to continue on and fail later. Change-Id: Idacd9274415b21db285a198dafff19b1d19a4a68 --- bin/dib-lint | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/dib-lint b/bin/dib-lint index c0d8d8c73..3b1582c15 100755 --- a/bin/dib-lint +++ b/bin/dib-lint @@ -66,7 +66,7 @@ for i in $(find elements -type f); do fi fi - # Check that all scripts are set -e + # Check that all scripts are set -eu # NOTE(bnemec): This doesn't verify that the set call occurs high # enough in the file to be useful, but hopefully nobody will be # sticking set calls at the end of their file to trick us. And if @@ -82,6 +82,12 @@ for i in $(find elements -type f); do rc=1 fi fi + if ! excluded setu; then + if [ -z "$(grep "^set -[^ ]*u" $i)" ]; then + echo "ERROR: $i is not set -u" + rc=1 + fi + fi fi done exit $rc