From 81f033d33b0df7af0243ff0b81ae5bc23e3dcbd4 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 31 Mar 2017 09:06:40 +1300 Subject: Handle POSIX correctness in ~/.bash_profile --- bash/bash_profile | 7 +++++++ 1 file changed, 7 insertions(+) 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 -- cgit v1.2.3