Browse code

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

Ian Wienand authored on 2015/03/11 07:45:59
Showing 1 changed files
... ...
@@ -21,6 +21,13 @@
21 21
 
22 22
 # Learn more and get the most recent version at http://devstack.org
23 23
 
24
+# check if someone has invoked with "sh"
25
+if [[ "${POSIXLY_CORRECT}" == "y" ]]; then
26
+    echo "You appear to be running bash in POSIX compatability mode."
27
+    echo "devstack uses bash features. \"./stack.sh\" should do the right thing"
28
+    exit 1
29
+fi
30
+
24 31
 # Make sure custom grep options don't get in the way
25 32
 unset GREP_OPTIONS
26 33