dotz/.config/bash/bashrc

59 lines
1.8 KiB
Bash

# ~/.config/bash/bashrc
LOCATION=".config/bash/bashrc"
# This file gets run in two cases:
# 1. non-login interactive shell
# 2. remote shell (over ssh or similar)
#
# #2 happens when you run "ssh user@host bash" explicitly.
# In this case, /etc/bash.bashrc has not been previous executed (unlike #1).
#
# Sauce:
# - https://blog.flowblok.id.au/2013-02/shell-startup-scripts.html
# - https://heptapod.host/flowblok/shell-startup/-/blob/branch/default/.bashrc
# {{{ === Script Debug Settings ===
#DEBUG=y # Comment this out to disable DEBUGing.
function _mordu {
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
}
function _mordu_n {
[ "$DEBUG" ] && echo -n ">>> Mordu@$LOCATION: $*"
}
function _mordu_nl {
[ "$DEBUG" ] && echo "$*"
}
_mordu "Beginning processing $LOCATION"
# }}} === Script Debug Settings ===
# {{{ === Sourcing env.bash ===
_mordu "Sourcing Env Vars from ~/.config/bash/env.bash."
source "$HOME"/.config/bash/env.bash
LOCATION=".config/bash/bashrc"
_mordu "Finished sourcing Env Vars from ~/.config/bash/env.bash."
# }}} === Sourcing env.bash ===
# {{{ === Interactive Shell Sanity Check ===
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# }}} === Interactive Shell Sanity Check ===
# {{{ === Source System Wide bashrc ===
_mordu "Sourcing /etc/bashrc."
if [ -f /etc/bashrc ]; then
source /etc/bashrc
fi
_mordu "Finished sourcing /etc/bashrc."
# }}} === Source System Wide bashrc ===
# {{{ === Source interactive.bash ===
_mordu "Sourcing Interactive Shell settings from ~/.config/bash/interactive.bash."
source "$HOME"/.config/bash/interactive.bash
LOCATION=".config/bash/bashrc"
_mordu "Finished sourcing Interactive Shell settings from ~/.config/bash/interactive.bash."
# }}} === Source interactive.bash ===
_mordu "Finished processing $LOCATION."