commands
This commit is contained in:
parent
3d5e4f5a68
commit
dcde6ddbc9
1 changed files with 12 additions and 1 deletions
|
@ -1,9 +1,15 @@
|
||||||
[ -n "${ENV}" ] || export ENV="/etc/shell/main.sh"
|
[ -n "${ENV}" ] || export ENV="/etc/shell/main.sh"
|
||||||
|
|
||||||
|
main_commands() {
|
||||||
|
local file="${1}"
|
||||||
|
grep "{\$" "${file}" |
|
||||||
|
cut --delimiter "(" --fields 1
|
||||||
|
}
|
||||||
|
|
||||||
main_source_directory() {
|
main_source_directory() {
|
||||||
local path="${1}"
|
local path="${1}"
|
||||||
if [ -d "${path}" ]; then
|
if [ -d "${path}" ]; then
|
||||||
local count ifs module modules
|
local cmd count ifs module modules
|
||||||
modules="$(find "${path}" \
|
modules="$(find "${path}" \
|
||||||
-type "f" \
|
-type "f" \
|
||||||
-name "*.sh" \
|
-name "*.sh" \
|
||||||
|
@ -22,9 +28,14 @@ main_source_directory() {
|
||||||
module="${path}/${module}"
|
module="${path}/${module}"
|
||||||
if [ "${module}" != "${ENV}" ]; then
|
if [ "${module}" != "${ENV}" ]; then
|
||||||
. "${module}"
|
. "${module}"
|
||||||
|
cmd="$(main_commands "${module}")"
|
||||||
|
[ -n "${cmd}" ] && CMD="${CMD}
|
||||||
|
${cmd}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
IFS="${ifs}"
|
IFS="${ifs}"
|
||||||
|
log_info
|
||||||
|
log_info "${CMD}"
|
||||||
else
|
else
|
||||||
echo "Not a directory: ${path}"
|
echo "Not a directory: ${path}"
|
||||||
return 1
|
return 1
|
||||||
|
|
Loading…
Reference in a new issue