code cleanup: force local var before calling a for loop, make sure it's unset when no longer needed

This commit is contained in:
fatalerrors
2021-10-06 10:37:13 +02:00
parent c0b1bf1665
commit 1ac3ec303c
9 changed files with 65 additions and 16 deletions

View File

@@ -76,12 +76,19 @@ show_version()
echo -e "${BWhite}init.sh${DEFAULTCOL} version ${BGreen}$VERSION${DEFAULTCOL}"
echo ""
echo "Modules disponibles :"
local mod=
for mod in $MYPATH/modules/*.sh; do
. $mod
local modname=$(get_mod_name $mod)
local version=VER_$modname
echo -e "\t$BWhite$modname${DEFAULTCOL}: $BGreen${!version}$DEFAULTCOL"
unset modname version
done
unset mod
if [[ $(id -u) -ne 0 ]]; then
echo -e "\n${BYellow}Attention :$DEFAULTCOL Ce script requiert les droits d'administration pour fonctionner."
fi
@@ -98,4 +105,3 @@ get_mod_name()
export -f get_mod_name
# EOF