dotfiles/dot_bashrc

45 lines
1016 B
Plaintext
Raw Normal View History

2021-04-12 21:56:06 -04:00
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
2021-05-11 12:35:00 -04:00
# start in home directory
2021-05-11 12:28:44 -04:00
# shellcheck disable=SC2164
2021-04-12 21:56:06 -04:00
if [ "$PWD" != "$HOME" ] && [ "$PWD" -ef "$HOME" ] ; then cd ; fi
2021-05-11 12:35:00 -04:00
# change $HOME on FreeBSD to /usr/home/andrew
2021-05-11 12:28:44 -04:00
# shellcheck disable=SC2164
2021-04-12 21:56:06 -04:00
if [ -d "/usr$HOME" ] ; then export HOME=/usr$HOME ; cd ; fi
2021-05-11 12:35:00 -04:00
# load system bashrc
2021-04-13 14:43:04 -04:00
for BASHRC in /etc/bashrc /etc/bash.bashrc /etc/bash/bashrc ; do
if [ -f "$BASHRC" ] ; then
2021-05-11 12:28:44 -04:00
# shellcheck source=/dev/null
2021-04-13 14:43:04 -04:00
. "$BASHRC"
2021-04-12 21:56:06 -04:00
fi
2021-04-13 14:43:04 -04:00
done
unset BASHRC
2021-04-12 21:56:06 -04:00
2021-05-11 12:35:00 -04:00
# this assumes nvim is always installed for $EDITOR
2021-04-13 14:43:04 -04:00
EDITOR=nvim; export EDITOR
2021-04-12 21:56:06 -04:00
2021-05-11 12:35:00 -04:00
# local paths
2021-05-11 12:28:44 -04:00
if ! [[ "$PATH" =~ $HOME/.local/bin:$HOME/bin: ]]
2021-04-13 14:43:04 -04:00
then
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH
2021-04-12 21:56:06 -04:00
# User specific aliases and functions
if [ -d ~/.bashrc.d ]; then
2021-04-13 14:43:04 -04:00
for rc in ~/.bashrc.d/*; do
if [ -f "$rc" ]; then
2021-05-11 12:28:44 -04:00
# shellcheck source=/dev/null
2021-04-13 14:43:04 -04:00
. "$rc"
fi
done
2021-04-12 21:56:06 -04:00
fi
unset rc
2021-05-11 12:35:00 -04:00
# direnv hook
if which direnv > /dev/null 2>&1 ; then
eval "$(direnv hook bash)"
fi