Modified _.load.sh with .<shell> loading
This commit is contained in:
parent
80883e1152
commit
4cbe98a22f
|
@ -46,22 +46,29 @@ if is_sourced; then
|
||||||
LOAD_EXIT=0
|
LOAD_EXIT=0
|
||||||
|
|
||||||
# The following constructs a list of load_next ... commands
|
# The following constructs a list of load_next ... commands
|
||||||
ALL_ENV_FILES="$(
|
FIND_CMD="$( printf "%s " \
|
||||||
find ~/.config/sz.env -xdev -type d -not -name '*.off' \
|
"find ~/.config/sz.env -xdev -type d -not -name '*.off'" \
|
||||||
-exec sh -c '
|
"-exec sh -c '" \
|
||||||
find "$1" -xdev -maxdepth 1 -type f -name "ID_*.env" | sort
|
'find "$1" -xdev -maxdepth 1 -type f' \
|
||||||
' shell '{}' ';' \
|
'-name "ID_*.env" -or -name "ID_*.env.'"${BASE_SHELL}"\" \
|
||||||
-exec sh -c '
|
"| sort' shell '{}' ';'" \
|
||||||
find "$1" -xdev -maxdepth 1 -type f -name "PATH_*.env" | sort
|
"-exec sh -c '" \
|
||||||
' shell '{}' ';' \
|
'find "$1" -xdev -maxdepth 1 -type f' \
|
||||||
-exec sh -c '
|
'-name "PATH_*.env" -or -name "PATH_*.env.'"${BASE_SHELL}"\" \
|
||||||
find "$1" -xdev -maxdepth 1 -type f -name "*.env" -not -name "ID_*" -not -name "PATH_*" -print | sort
|
"| sort' shell '{}' ';'" \
|
||||||
' shell '{}' ';' \
|
"-exec sh -c '" \
|
||||||
-exec sh -c '
|
'find "$1" -xdev -maxdepth 1 -type f' \
|
||||||
find "$1" -xdev -maxdepth 1 -type f -name "PATH_zz_cleanup.env"
|
'-name "*.env" -or -name "*.env.'"${BASE_SHELL}"\" \
|
||||||
' shell '{}' ';' \
|
'| grep -Ev "/(PATH|ID)_[^/]+$"' \
|
||||||
| sed -e 's/^/load_next "/; s/$/";/'
|
"| sort' shell '{}' ';'" \
|
||||||
|
"-exec sh -c '" \
|
||||||
|
'find "$1" -xdev -maxdepth 1 -type f -name "PATH_zz_cleanup.env"' \
|
||||||
|
"' shell '{}' ';'"
|
||||||
)"
|
)"
|
||||||
|
ALL_ENV_FILES="$(
|
||||||
|
eval "$FIND_CMD" | sed -e 's/^/load_next "/; s/$/";/'
|
||||||
|
)"
|
||||||
|
${DBG/%1/:} unset FIND_CMD
|
||||||
if [ -n "$DBG_NO_SZ_LOAD" ]; then
|
if [ -n "$DBG_NO_SZ_LOAD" ]; then
|
||||||
ALL_ENV_FILES=$(<<<"$ALL_ENV_FILES" sed -Ee '
|
ALL_ENV_FILES=$(<<<"$ALL_ENV_FILES" sed -Ee '
|
||||||
/PATH_/!s/^(load_next )/# \1/
|
/PATH_/!s/^(load_next )/# \1/
|
||||||
|
@ -70,6 +77,7 @@ if is_sourced; then
|
||||||
fi
|
fi
|
||||||
# Run the constructed (see above) list
|
# Run the constructed (see above) list
|
||||||
eval "$ALL_ENV_FILES"
|
eval "$ALL_ENV_FILES"
|
||||||
|
${DBG/%1/:} unset ALL_ENV_FILES
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
load_all
|
load_all
|
||||||
|
|
Loading…
Reference in New Issue