From 616ed83639d012bd95953f839a81737d2c30b9d4 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 17 Aug 2016 20:12:32 +1200 Subject: Simplify end-of-file loop in bashrc --- bash/bashrc | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) (limited to 'bash') diff --git a/bash/bashrc b/bash/bashrc index e719efee..ef80a8eb 100644 --- a/bash/bashrc +++ b/bash/bashrc @@ -106,28 +106,12 @@ if [[ $COMP_WORDBREAKS ]] ; then COMP_WORDBREAKS=${COMP_WORDBREAKS//:} fi -# If this wasn't a login shell, load in the POSIX shell functions -case $- in - *l*) ;; - *) - for shrc in "$HOME"/.shrc.d/*.sh ; do - [[ -e $shrc ]] || continue - source "$shrc" - done - unset -v shrc - ;; -esac - -# Load any supplementary scripts -for bashrc in "$HOME"/.bashrc.d/*.bash ; do - [[ -e $bashrc ]] || continue - source "$bashrc" -done -unset -v bashrc - -# Load any completion files -for bashcmp in "$HOME"/.bash_completion.d/*.bash ; do - [[ -e $bashcmp ]] || continue - source "$bashcmp" +# Load POSIX shell functions, Bash-specific scripts, and Bash completion files, +# in that order +for sh in "$HOME"/.shrc.d/*.sh \ + "$HOME"/.bashrc.d/*.bash \ + "$HOME"/.bash_completion.d/*.bash ; do + [[ -e $sh ]] || continue + source "$sh" done -unset -v bashcmp +unset -v sh -- cgit v1.2.3