Inspired by Gentoo's setup of /etc/env.d, /etc/profile.d, etc.
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
if [[ $- != *i* ]] ; then
- # Shell is non-interactive. Be done now!
- return
+ # Shell is non-interactive. Be done now!
+ return
fi
-#source .bashrc.d/local_paths
-
# If not running interactively, don't do anything else
[ -z "$PS1" ] && return
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
-source ~/.bashrc.d/environment
-#source ~/.bashrc.d/screen
-#source ~/.bashrc.d/completion
-#source ~/.bashrc.d/nobeep
-#source ~/.bashrc.d/lesspipe
-source ~/.bashrc.d/ssh_agent
-source ~/.bashrc.d/gpg_agent
-
-# load aliases
-if [ -f ~/.bash_aliases ]; then
- . ~/.bash_aliases
-fi
+for FILE in ~/.bashrc.d/*; do
+ if [ -f "${FILE}" ]; then
+ source "${FILE}"
+ fi
+done
-source ~/src/dotfiles/public/src/.bashrc.d/dotfiles
+# reduce environment pollution
+unset FILE
--- /dev/null
+# Detect the type of system we're running on
+#
+# This makes it easy to adjust script locations and so forth to match
+# your system's file placement and other quirks.
+
+if [ -z "${OS}" ]; then
+ export OS='UNKNOWN'
+ if [ -f '/etc/make.conf' ]; then
+ export OS='Gentoo'
+ elif [ "${SHELL#*gentoo}" != "${SHELL}" ]; then # assumes 'gentoo' in prefix
+ export OS='Gentoo Prefix'
+ elif ! grep -i debian /etc/issue; then
+ export OS='Debian'
+ elif ! grep -i ubuntu /etc/issue; then
+ export OS='Ubuntu'
+ else
+ echo "unknown system. Adjust .bashrc.d/01detect_system or set OS by hand" >&2
+ fi
+fi
--- /dev/null
+# enable programmable completion
+#
+# You don't need to enable this if it's already enabled globally for
+# your system.
+
+if [ "${OS}" = 'Gentoo' ]; then
+ # Gentoo-based systems
+ #
+ # Bash completion comes from the 'app-shells/bash_completion' package,
+ # which stores the initialization script in
+ # /etc/profile.d/bash_completion.sh
+ if [ -f /etc/profile.d/bash_completion.sh ]; then
+ . /etc/profile.d/bash_completion.sh
+ fi
+elif [ "${OS}" = 'Debian' ] || [ "${OS}" = 'Ubuntu' ]; then
+ # Debian-based systems
+ #
+ # Bash completion comes from the 'bash' package, which stores the
+ # initialization script in
+ # /etc/bash_completion
+ # You won't need to enable this if you uncommented the appropriate
+ # section in /etc/bash.bashrc.
+ if [ -f /etc/bash_completion ]; then
+ . /etc/bash_completion
+ fi
+fi
+
+# bugs-everywhere completion
+#if [ -f ~/.be-completion.sh ]; then
+# source ~/.be-completion.sh
+#fi
--- /dev/null
+# make less more friendly for non-text input files, see lesspipe(1)
+# (Debian-based systems only)
+
+if [ "${OS}" = "Debian" ] || [ "${OS}" = "Ubuntu" ]; then
+ [ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
+fi
# turn off terminal beep in X
-if [ $TERM == "xterm" ] && [ -n "$DISPLAY" ]
- then
- xset b off
+if [ $TERM == "xterm" ] && [ -n "$DISPLAY" ]; then
+ xset b off
fi
# turn of terminal beeps in the console, unless connecting via SSH
if [ -z "$SSH_CLIENT" ]; then
- if [ ! -z "$TERM" ]; then
- setterm -blength 0
- fi
+ if [ ! -z "$TERM" ]; then
+ setterm -blength 0
+ fi
fi
--- /dev/null
+if [ "${OS}" = 'Ubuntu' ]; then
+ # adjust for Ubuntu not recognizing screen.* terms
+ if [ "${TERM:0:7}" == "screen." ]; then
+ export TERM="${TERM:7}"
+ fi
+fi
+++ /dev/null
-# enable programmable completion features (you don't need to enable
-# this if it's already enabled in /etc/bash.bashrc and /etc/profile
-# sources /etc/bash.bashrc).
-if [ -f /etc/bash_completion ]; then
- . /etc/bash_completion
-fi
-
-# bugs-everywhere completion
-if [ -f ~/.be-completion.sh ]; then
- source ~/.be-completion.sh
-fi
+++ /dev/null
-# make less more friendly for non-text input files, see lesspipe(1)
-[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
+++ /dev/null
-# adjust for Ubuntu not recognizing screen.* terms
-if [ "${TERM:0:7}" == "screen." ]; then
- export TERM="${TERM:7}"
-fi