dotfiles/.bashrc

78 lines
1.0 KiB
Bash
Raw Permalink Normal View History

2022-10-15 03:58:23 +00:00
if [[ $- != *i* ]]; then
return
fi
###
# Default Environment
###
2022-10-25 00:17:15 +00:00
__dotlib_set_PATH() {
2022-10-15 03:58:23 +00:00
local path paths=("$HOME"/bin {/usr{/local,},}/{,s}bin)
printf -v path %s: "${paths[@]}"
export PATH=${path%:}
}
2022-10-25 00:17:15 +00:00
__dotlib_set_ENV() {
2022-10-15 03:58:23 +00:00
local var
declare -A env=(
[EDITOR]=nano
[PAGER]=less
[LESSHISTFILE]=-
[HISTCONTROL]=ignoreboth
)
for var in "${!env[@]}"; do
export "$var"="${env[$var]}"
done
}
2022-10-25 00:17:15 +00:00
__dotlib_set_SHOPTS() {
2022-10-15 03:58:23 +00:00
local shopts=(
{null,ext,dot}glob globstar cmdhist
hostcomplete checkwinsize checkhash
)
shopt -s "${shopts[@]}"
}
2022-10-25 00:17:15 +00:00
__dotlib_set_PATH
__dotlib_set_ENV
__dotlib_set_SHOPTS
2022-10-15 03:58:23 +00:00
ulimit -c unlimited
###
# Library loader
###
2022-10-25 00:17:15 +00:00
__dotlib_load_libraries() {
2022-10-25 00:33:50 +00:00
local os dot{,s}
2022-10-25 00:17:15 +00:00
case $OSTYPE in
darwin*)
os=darwin
;;
*)
os=unknown
esac
dots=(
~/bin/dotlib/generic-pre/*.sh
~/bin/dotlib/"$os"/*.sh
~/bin/dotlib/generic-post/*.sh
)
for dot in "${dots[@]}"; do
. "$dot"
done
}
__dotlib_load_libraries
###
# Reset exit status
###
true