Modular global bash setup

Shell configuration is split across modular files rather than a single .bashrc. The global /etc/bash.bashrc sources every .sh file in /etc/bashrc.d/ in order. Each file handles one concern.

The Loader

/etc/bash.bashrc checks for an interactive shell, then sources each readable .sh file in /etc/bashrc.d/:

case $- in
    *i*) ;;
      *) return;;
esac

if [ -d "/etc/bashrc.d" ]; then
  for f in "/etc/bashrc.d"/*.sh; do
    [ -f "$f" ] && [ -r "$f" ] && . "$f"
  done
fi

Per-User Customization

Each project runs under its own limited user account. The global /etc/bashrc.d/ directory gives every user the same base configuration without per-user setup. 95-user_bash.sh adds an optional per-user extension point:

[[ -f "$HOME/.user_bash" ]] && . "$HOME/.user_bash"

If ~/.user_bash exists in a user’s home directory, it is sourced. If it does not exist, nothing happens. The 95- prefix places it late in the load order, so per-user settings apply after all global defaults.