Package:
bash
Source:
bash
Description:
GNU Bourne Again SHell
Submitter:
Date:
2024-04-15 12:15:03 UTC
Severity:
wishlist
Tags:
#894999#5
Date:
2018-04-06 02:48:16 UTC
From:
To:
I'd like to see support for ~/.config/bashrc.d or ~/.bashrc.d added to
/etc/skel/.bashrc to make it easier to manage setup for things like
golang-go.

```
# Include config files
if [ -d "${XDG_CONFIG_HOME:-"${HOME}/.config"}/bashrc.d" ]; then
  while read -r file
  do
    source "${file}"
  done < <(find "${XDG_CONFIG_HOME:-"${HOME}/.config"}/bashrc.d" -type f
-executable 2>/dev/null)
elif [ -d "${HOME}/.bashrc.d" ]; then
  while read -r file
  do
    source "${file}"
  done < <(find "${HOME}/.bashrc.d" -type f -executable 2>/dev/null)
fi
```

#894999#12
Date:
2019-10-16 12:36:27 UTC
From:
To:
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!