Configuring bash for your own use #
The default .bashrc provided by a redhat systems looks a bit
like this:
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]; then
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
if [ -d ~/.bashrc.d ]; then
for rc in ~/.bashrc.d/*; do
if [ -f "$rc" ]; then
. "$rc"
fi
done
fi
unset rcThis sourced profile in turn:
- sources
/etc/bashrc - sets a basic path for the user
- allows for local overrides based on
~/.bashrc.d
For most this is sufficient, though the limitations become obvious
quickly. Hence you see the /etc/bashrc on top and the
~/.bashrc.d configuration in the bottom.
It is meant to be customized
I used to have my config in a dedicated setup but have switched over to chezmoi and the changed my approach to configuration quite a bit. So instead of dumping a configuration file I’ll walk you through the main meat of my configuration and explain the choices I’ve made.
Tips #
Regardless of your choices some obvious (and less obvious) tips can be given.
Note
Core functionality is leading
Whatever cool thing you introduce to your stack, if it doesn’t play nice with the rest it needs to go.
Note
Code is like sex, one mistake and you will be maintaining it the rest of your life.
Don’t be too eager to add crap to your configuration.