sh/bash/main.sh
2023-05-14 23:24:40 +02:00

25 lines
595 B
Bash

#! /usr/bin/env bash
MAIN_FILE="$(realpath "${BASH_SOURCE[0]}")"
MAIN_ROOT="$(dirname "${MAIN_FILE}")"
function link_bashrc {
local file='/etc/bash.bashrc'
rm --force "${file}"
ln --symbolic "${MAIN_FILE}" "${file}"
}
# import modules
function main_import_modules {
local IFS=$'\n'
local modules=($(find "${MAIN_ROOT}" -type 'f' -name '*.sh'))
log_trace "${modules[@]}"
local module
for module in "${modules[@]}" ; do
if [ "${module}" != "${MAIN_FILE}" ] ; then
source "${module}"
fi
done
}
# import modules
main_import_modules