From 2c6040d416792ca8c57ffbf5397b3aca5800a49d Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 18 Sep 2016 01:33:02 +1200 Subject: Source $ENV even if running ancient Bash --- bash/bashrc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'bash') diff --git a/bash/bashrc b/bash/bashrc index a48a9081..1c7d7802 100644 --- a/bash/bashrc +++ b/bash/bashrc @@ -4,6 +4,10 @@ case $- in *) return ;; esac +# If ENV is set, source it to get all the POSIX-compatible interactive stuff; +# we should be able to do this even if we're running a truly ancient Bash +[ -n "$ENV" ] && . "$ENV" + # Ensure we're using at least version 2.05. Weird arithmetic syntax needed here # due to leading zeroes and trailing letters in some 2.x version numbers (e.g. # 2.05a). @@ -82,8 +86,8 @@ if ((BASH_VERSINFO[0] >= 4)) ; then ((BASH_VERSINFO[1] >= 3)) && shopt -s direxpand fi -# Load POSIX shell startup files and then Bash-specific ones -for sh in "$ENV" "$HOME"/.bashrc.d/*.bash ; do +# Load Bash-specific startup files +for sh in "$HOME"/.bashrc.d/*.bash ; do [[ -e $sh ]] && source "$sh" done unset -v sh -- cgit v1.2.3