Here is a simpler patch that doesn't recurse subdirectories.

--- a/skel.bashrc       2015-01-28 11:34:29.000000000 -0500
+++ b/skel.bashrc       2019-10-16 08:12:02.000000000 -0400
@@ -111,3 +111,16 @@
     . /etc/bash_completion
   fi
 fi
+
+# include config files
+if [ -d "${XDG_CONFIG_HOME:-"${HOME}/.config"}/bashrc.d" ]; then
+    for config in ${XDG_CONFIG_HOME:-"${HOME}/.config"}/bashrc.d/* ; do
+        [ -x "$config" ] || continue
+        . $config
+    done
+elif [ -d "${HOME}/.bashrc.d" ]; then
+    for config in ${HOME}/.bashrc.d/* ; do
+        [ -x "$config" ] || continue
+        . $config
+    done
+fi

Another approach would be to use `ucf` to share `/etc/skel/.bashrc` with
a [bash-bashrc.d](https://github.com/LucidOne/bash-bashrc.d) package.

Other applications that want to modify a users `.bashrc` include
`byobu`, `autojump`, and `direnv`. This should approach will prevent
these applications from having to parse `~/.bashrc` to enable or disable
functionality.

Thanks!

Reply via email to