aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-03-31 09:06:40 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-03-31 09:06:40 +1300
commit81f033d33b0df7af0243ff0b81ae5bc23e3dcbd4 (patch)
tree6919ebfc746ab56ea7d7b2ca37604e8448b62e87
parentUpdate submodules (diff)
downloaddotfiles-81f033d33b0df7af0243ff0b81ae5bc23e3dcbd4.tar.gz
dotfiles-81f033d33b0df7af0243ff0b81ae5bc23e3dcbd4.zip
Handle POSIX correctness in ~/.bash_profile
-rw-r--r--bash/bash_profile7
1 files changed, 7 insertions, 0 deletions
diff --git a/bash/bash_profile b/bash/bash_profile
index a520f051..0376ee57 100644
--- a/bash/bash_profile
+++ b/bash/bash_profile
@@ -1,6 +1,13 @@
# Load ~/.profile regardless of shell version
[ -e "$HOME"/.profile ] && . "$HOME"/.profile
+# If POSIXLY_CORRECT is set after doing that, force the `posix` option on and
+# don't load the rest of this stuff--so, just ~/.profile and ENV
+if [ -n "$POSIXLY_CORRECT" ] ; then
+ set -o posix
+ return
+fi
+
# If ~/.bashrc exists, source that too; the tests for both interactivity and
# >=2.05a (for features like [[) are in there
[ -f "$HOME"/.bashrc ] && . "$HOME"/.bashrc