ifs
This commit is contained in:
parent
dae14f780e
commit
2a568eeb22
1 changed files with 9 additions and 8 deletions
17
bash/main.sh
17
bash/main.sh
|
@ -16,19 +16,20 @@ main_link_bashrc() {
|
||||||
main_import_modules() {
|
main_import_modules() {
|
||||||
local file="${1}"
|
local file="${1}"
|
||||||
if [ -f "${file}" ]; then
|
if [ -f "${file}" ]; then
|
||||||
local path
|
local ifs module modules path root
|
||||||
local root
|
path="$(realpath --canonicalize-existing "${file}")"
|
||||||
path="$(realpath "${file}")"
|
|
||||||
root="$(dirname "${path}")"
|
root="$(dirname "${path}")"
|
||||||
local IFS=$'\n'
|
modules="$(find "${root}" -type "f" -name "*.sh" | sort)"
|
||||||
local modules=($(find "${root}" -type "f" -name "*.sh" | sort))
|
ifs="${IFS}"
|
||||||
local module
|
IFS="
|
||||||
for module in "${modules[@]}"; do
|
"
|
||||||
|
for module in ${modules}; do
|
||||||
if [ "${module}" != "${path}" ]; then
|
if [ "${module}" != "${path}" ]; then
|
||||||
. "${module}"
|
. "${module}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
log_trace "${modules[@]}"
|
IFS="${ifs}"
|
||||||
|
log_trace "${modules}"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
log_fatal "No file: ${file}"
|
log_fatal "No file: ${file}"
|
||||||
|
|
Loading…
Reference in a new issue