simplify interactive shell check in bash_profile; add check for bash_profile existence before sourcing

This commit is contained in:
2026-10-21 17:11:39 -06:00
parent 2083bcc6a4
commit d5567ef7ca
2 changed files with 6 additions and 9 deletions

View File

@@ -2,25 +2,22 @@
# Adrian Abeyta <adrian@adrianabeyta.com>
# don't do anything if not running interactively
case $- in
*i*) ;;
*) return;;
esac
[[ $- != *i* ]] && return
# include user home bins if they exist
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi;
fi
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi;
fi
# load the dotfiles
for file in ~/.{env,path,functions,aliases,prompt}; do
[ -r "$file" ] && [ -f "$file" ] && \
source "$file";
done;
unset file;
unset file
# fun scripts
if is_true "${HAVE_FUN:-}"; then
@@ -35,4 +32,4 @@ shopt -s checkwinsize # update col/line values on each command
# enable tab completion for 'g' by marking as alias for 'git'
if type _git &> /dev/null; then
complete -o default -o nospace -F _git g;
fi;
fi

View File

@@ -1 +1 @@
[ -n "$PS1" ] && source ~/.bash_profile;
[ -n "$PS1" ] && [[ -f ~/.bash_profile ]] && source ~/.bash_profile;