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
This commit is contained in:
Ben Nemec 2014-04-11 19:39:50 -05:00
parent 16be6d7ce0
commit e0650572f2

View File

@ -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