From 53d23a5f21c05f34ae45a92eea9c2c7e05eedfcf Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Sun, 6 Dec 2020 16:49:07 -0800 Subject: [PATCH] Add support for config directories for bashrc --- bash/.bashrc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/bash/.bashrc b/bash/.bashrc index 209a36f..2052da8 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -52,3 +52,23 @@ fi if [ "$TERM" == xterm ]; then export TERM=xterm-256color fi + +if [ -d "${XDG_CONFIG_HOME}"/bash/bashrc.d ]; then + for file in "${XDG_CONFIG_HOME}"/bash/bashrc.d/*.sh; do + if [ -r "$file" ]; then + #shellcheck disable=1090 + . "$file" + fi + done +fi + +if [[ -d "${XDG_CONFIG_HOME}/bash/env.d" ]]; then + for file in "${XDG_CONFIG_HOME}"/bash/env.d/*.env; do + eval "$( + grep -v '^\s*\#' "${file}" | + grep -v '^\s*$' | + sed 's/^\s*export//g' | + sed 's/^/export /g' + )" + done +fi