2022-02-03
This commit is contained in:
parent
f86b8496ec
commit
db393215ce
55 changed files with 1907 additions and 0 deletions
30
home/dot-local/lib/bash/init.sh
Normal file
30
home/dot-local/lib/bash/init.sh
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Shell options which will be like a strict mode
|
||||
set -${DEBUG:+x}euo pipefail
|
||||
|
||||
# This script should be sourced before any of
|
||||
# the other scripts in this repo. Other scripts
|
||||
# make use of ${BASH_LIB_DIR} to find each other.
|
||||
|
||||
# Get the relative path to the repo root
|
||||
# shellcheck disable=SC2086
|
||||
BASH_LIB_DIR_RELATIVE="$(dirname ${BASH_SOURCE[0]})"
|
||||
|
||||
# Must be set in order to load the filehandling
|
||||
# module. Will be updated when abs_path is available.
|
||||
BASH_LIB_DIR="${BASH_LIB_DIR_RELATIVE}"
|
||||
|
||||
for name in common; do
|
||||
source "${BASH_LIB_DIR_RELATIVE}/${name}/${name}.sh"
|
||||
done
|
||||
|
||||
# Filter functions and re export only bash-lib functions to subshells
|
||||
eval "$(declare -F | sed -e 's/-f /-fx /' | grep 'x bl_')"
|
||||
|
||||
# Export the absolute path
|
||||
# shellcheck disable=SC2086
|
||||
BASH_LIB_DIR="$(realpath ${BASH_LIB_DIR_RELATIVE})"
|
||||
export BASH_LIB_DIR
|
||||
|
||||
MODULEPATH="${MODULEPATH:+"${MODULEPATH}:"}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue