aboutsummaryrefslogtreecommitdiff
path: root/bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-08-17 17:42:55 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-08-17 17:42:55 +1200
commitf7e5f83f2ad6f0bfaff75ce16d67088f1797e242 (patch)
tree18928c42a4300cab8828cce7305e36c3a31f0625 /bash
parentMove simple Bash/pdksh functions into POSIX sh (diff)
downloaddotfiles-f7e5f83f2ad6f0bfaff75ce16d67088f1797e242.tar.gz
dotfiles-f7e5f83f2ad6f0bfaff75ce16d67088f1797e242.zip
Move -i test in Bash to end of ~/.bash_profile
Diffstat (limited to 'bash')
-rw-r--r--bash/bash_profile8
-rw-r--r--bash/bashrc5
2 files changed, 4 insertions, 9 deletions
diff --git a/bash/bash_profile b/bash/bash_profile
index ee735720..d0850004 100644
--- a/bash/bash_profile
+++ b/bash/bash_profile
@@ -23,7 +23,7 @@ if [[ -d $HOME/.bash_profile.d ]] ; then
unset -v bash_profile
fi
-# Source interactive Bash config if it exists
-if [[ -e $HOME/.bashrc ]] ; then
- source "$HOME"/.bashrc
-fi
+# If the shell is interactive, and ~/.bashrc exists, source that too
+case $- in
+ *i*) [[ -f "$HOME"/.bashrc ]] && source "$HOME"/.bashrc ;;
+esac
diff --git a/bash/bashrc b/bash/bashrc
index b551819d..56ab7fda 100644
--- a/bash/bashrc
+++ b/bash/bashrc
@@ -8,11 +8,6 @@ elif ((BASH_VERSINFO[0] == 2)) &&
return
fi
-# Don't do anything if not running interactively
-if [[ $- != *i* ]] ; then
- return
-fi
-
# Don't do anything if running a restricted shell
if shopt -q restricted_shell ; then
return