From e292eb508413b9174684a8e75c93474a7f5351ee Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 23 Aug 2021 23:07:31 -0500 Subject: Initial --- bootstrap/bashrc | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 bootstrap/bashrc (limited to 'bootstrap/bashrc') diff --git a/bootstrap/bashrc b/bootstrap/bashrc new file mode 100644 index 0000000..4966e75 --- /dev/null +++ b/bootstrap/bashrc @@ -0,0 +1,41 @@ +# bashrc + +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +BASH_SOURCE_FIRST=( + aliases + functions +) + +BASH_SOURCE_LAST=( + blesh +) + +for f in "${BASH_SOURCE_FIRST[@]}"; do + file="${XDG_CONFIG_HOME:-$HOME/.config}/bash/$f.bash" + [[ -r "$file" ]] && source "$file" # || echo >&2 "no '$file' found" +done + +for file in "$XDG_CONFIG_HOME"/bash/*.bash; do + file_base="${file##*/}" + memq "${file_base%.bash}" "${BASH_SOURCE_FIRST[@]}" && { + # echo >&2 "'$file' in BASH_SOURCE_FIRST, skipping" + continue + } + memq "${file_base%.bash}" "${BASH_SOURCE_LAST[@]}" && { + # echo >&2 "'$file' in BASH_SOURCE_LAST, skipping" + continue + } + [[ -r "$file" ]] && { + # echo >&2 "Sourcing '$file'" + source "$file" + } + unset file_base +done + +for f in "${BASH_SOURCE_LAST[@]}"; do + file="${XDG_CONFIG_HOME:-$HOME/.config}/bash/$f.bash" + [[ -r "$file" ]] && source "$file" # || echo >&2 "no '$file' found" + true +done -- cgit 1.4.1-21-gabe81