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

26 lines
611 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'))
local module
for module in "${modules[@]}" ; do
if [ "${module}" != "${MAIN_FILE}" ] ; then
echo
echo "${module}"
source "${module}"
fi
done
}
# import modules
main_import_modules