This commit is contained in:
Marc Beninca 2024-11-17 18:11:25 +01:00
parent 3d5e4f5a68
commit dcde6ddbc9
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -1,9 +1,15 @@
[ -n "${ENV}" ] || export ENV="/etc/shell/main.sh"
main_commands() {
local file="${1}"
grep "{\$" "${file}" |
cut --delimiter "(" --fields 1
}
main_source_directory() {
local path="${1}"
if [ -d "${path}" ]; then
local count ifs module modules
local cmd count ifs module modules
modules="$(find "${path}" \
-type "f" \
-name "*.sh" \
@ -22,9 +28,14 @@ main_source_directory() {
module="${path}/${module}"
if [ "${module}" != "${ENV}" ]; then
. "${module}"
cmd="$(main_commands "${module}")"
[ -n "${cmd}" ] && CMD="${CMD}
${cmd}"
fi
done
IFS="${ifs}"
log_info
log_info "${CMD}"
else
echo "Not a directory: ${path}"
return 1