diff --git a/bash/main.sh b/bash/main.sh index 9b7afdd..ad08f22 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -12,21 +12,22 @@ function main_link_bashrc { # import modules function main_import_modules { -local root="${1}" -if [ -d "${root}" ] ; then +local file="${1}" +if [ -f "${file}" ] ; then + local root="$(dirname "${file}")" local IFS=$'\n' local modules=($(find "${root}" -type 'f' -name '*.sh')) local module for module in "${modules[@]}" ; do - if [ "${module}" != "${MAIN_BASH_FILE}" ] ; then + if [ "${module}" != "${file}" ] ; then source "${module}" fi done log_trace "${modules[@]}" else - log_fatal "No directory: ${root}" + log_fatal "No file: ${file}" fi } # import modules -main_import_modules "${MAIN_BASH_ROOT}" +main_import_modules "${MAIN_BASH_FILE}"