feat(modules): extract date_time module
This commit is contained in:
parent
e7b50832f9
commit
a436f766cb
3 changed files with 79 additions and 1 deletions
30
test_cat.sh
Executable file
30
test_cat.sh
Executable file
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
|
||||
load_modules() {
|
||||
local loaded_modules
|
||||
|
||||
local modules_path=$1
|
||||
local modules_list=$2
|
||||
|
||||
local modules_array
|
||||
read -a modules_array <<< "$modules_list"
|
||||
|
||||
local module_name
|
||||
for module_name in ${modules_array[@]}
|
||||
do
|
||||
local module_path=$modules_path/$module_name.sh
|
||||
source $module_path
|
||||
|
||||
if [[ 0 -eq $? ]]
|
||||
then
|
||||
loaded_modules=$loaded_modules$( show_$module_name )
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
echo $loaded_modules
|
||||
}
|
||||
|
||||
module_path="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/modules
|
||||
module_list="user host date_time"
|
||||
echo $( load_modules "$module_path" "$module_list" )
|
Loading…
Add table
Add a link
Reference in a new issue