diff --git a/sh/main.sh b/sh/main.sh index 92edc7b..2c240b6 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -9,18 +9,27 @@ SH_MAIN="${SH_ROOT}/${SH_MAIN_NAME}" [ -n "${ENV}" ] || export ENV="${SH_MAIN}" -sh_source_check() { - local file=".shellcheck.sh" - local ifs module modules - modules="$(sh_source_find "." "${file}")" - rm --force "${file}" - ifs="${IFS}" +_sh_ifs_new() { + SH_IFS="${IFS}" IFS=" " +} + +_sh_ifs_pop() { + IFS="${SH_IFS}" + unset SH_IFS +} + +sh_source_check() { + local file=".shellcheck.sh" + local module modules + modules="$(sh_source_find "." "${file}")" + rm --force "${file}" + _sh_ifs_new for module in ${modules}; do echo ". \"${module}\"" >>"${file}" done - IFS="${ifs}" + _sh_ifs_pop shellcheck \ --check-sourced \ "${file}" @@ -69,9 +78,7 @@ main_source_directory() { fi local cmd count ifs module modules modules="$(sh_source_find "${path}" "${SH_MAIN_NAME}")" - ifs="${IFS}" - IFS=" -" + _sh_ifs_new count=0 _sh_main_log "" \ ". ${path}" @@ -88,7 +95,7 @@ main_source_directory() { CMD="${CMD}${cmd}" fi done - IFS="${ifs}" + _sh_ifs_pop } main_source_file() {