Fail if run in POSIX compatability mode

This is mostly to detect if someone is running the script with "sh
./stack.sh" where sh is the bash-symlink that puts it in POSIX mode
(this can be invoked in other ways, but much less common).

In this case POSIXLY_CORRECT is set; so if we see that, bail out early
before we start hitting syntax errors.

Closes-Bug: #1430535
Change-Id: I7bbc4b0f656df9f6d9da2243c8caeb42d30ace95
This commit is contained in:
Ian Wienand 2015-03-11 09:45:59 +11:00
parent d8b66662d5
commit 4d74e0f495

View File

@ -21,6 +21,13 @@
# Learn more and get the most recent version at http://devstack.org
# check if someone has invoked with "sh"
if [[ "${POSIXLY_CORRECT}" == "y" ]]; then
echo "You appear to be running bash in POSIX compatability mode."
echo "devstack uses bash features. \"./stack.sh\" should do the right thing"
exit 1
fi
# Make sure custom grep options don't get in the way
unset GREP_OPTIONS