feat: add module_print to module.lib will print the source of requested module

master
Kebler Network System Administrator 2022-02-26 17:34:33 -08:00
parent a31e294a87
commit 51f73ccc02
1 changed files with 11 additions and 1 deletions

View File

@ -76,11 +76,21 @@ local FILE
FILE=$(module_find $1)
[ $? -ne 0 ] && echo no module $1 found && return 1
# source $FILE "$0"
[[ $BASHPID -eq $$ ]] || echo $FILE
# [[ $BASHPID -eq $$ ]] || echo $FILE
source $FILE
return 0
}
module_print() {
[ ! $1 ] && echo "no module specified" && return 1
# (return 0 2>/dev/null) && echo "module_load was sourced" || echo "module_log was executed"
local FILE
FILE=$(module_find $1)
[ $? -ne 0 ] && echo no module $1 found && return 1
cat $FILE
return 0
}
module_loaded() {
[ ! $1 ] && echo "no module specified" && return 1
local func