Unset var at the end of functions
This commit is contained in:
parent
c30debad59
commit
d3fdd52074
|
@ -83,7 +83,6 @@ OPTIONS :
|
|||
works with NSLCD − /etc/nslcd.conf).
|
||||
|
||||
EOF
|
||||
|
||||
}
|
||||
# }}}
|
||||
debug_message() { # {{{
|
||||
|
@ -93,6 +92,8 @@ debug_message() { # {{{
|
|||
## Print message if DEBUG is enable (=0)
|
||||
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6b\e[m\n' "DEBUG − ${PROGNAME} : ${local_message}"
|
||||
|
||||
unset local_message
|
||||
|
||||
return 0
|
||||
}
|
||||
# }}}
|
||||
|
@ -104,6 +105,8 @@ error_message() { # {{{
|
|||
## Print error message
|
||||
printf '%b\n' "ERROR − ${PROGNAME} : ${RED}${local_error_message}${RESET}"
|
||||
|
||||
unset local_error_message
|
||||
|
||||
exit "${local_error_code:=66}"
|
||||
}
|
||||
# }}}
|
||||
|
@ -178,8 +181,10 @@ Test var: ${1}."
|
|||
shift
|
||||
done
|
||||
|
||||
return "${return_var_empty}"
|
||||
unset local_total_var
|
||||
unset loop_count_var_empty
|
||||
|
||||
return "${return_var_empty}"
|
||||
}
|
||||
# }}}
|
||||
is_var_empty_silent() { # {{{
|
||||
|
@ -203,8 +208,10 @@ is_var_empty_silent() { # {{{
|
|||
shift
|
||||
done
|
||||
|
||||
return "${return_var_empty_silent}"
|
||||
unset local_total_var
|
||||
unset loop_count_var_empty_silent
|
||||
|
||||
return "${return_var_empty_silent}"
|
||||
}
|
||||
# }}}
|
||||
is_command_available() { # {{{
|
||||
|
@ -224,8 +231,9 @@ ${RED}${local_command_available_cmd}${COLOR_DEBUG} is not available on this host
|
|||
return_command_available="1"
|
||||
fi
|
||||
|
||||
return "${return_command_available}"
|
||||
unset local_command_available_cmd
|
||||
|
||||
return "${return_command_available}"
|
||||
}
|
||||
# }}}
|
||||
is_directory_absent() { # {{{
|
||||
|
@ -247,8 +255,9 @@ The directory ${RED}${local_directory_absent}${COLOR_DEBUG} exists."
|
|||
The directory ${RED}${local_directory_absent}${COLOR_DEBUG} doesn't exist."
|
||||
fi
|
||||
|
||||
return "${return_is_directory_absent}"
|
||||
unset local_directory_absent
|
||||
|
||||
return "${return_is_directory_absent}"
|
||||
}
|
||||
# }}}
|
||||
get_ldap_user_list() { # {{{
|
||||
|
@ -280,7 +289,6 @@ Error in ${RED}ldapsearch${COLOR_DEBUG} command for ${ldap_group_cn} LDAP group.
|
|||
fi
|
||||
|
||||
return "${return_get_ldap_user_list}"
|
||||
|
||||
}
|
||||
# }}}
|
||||
is_file_present() { # {{{
|
||||
|
@ -302,8 +310,9 @@ The file ${RED}${local_file_present}${COLOR_DEBUG} exists."
|
|||
The file ${RED}${local_file_present}${COLOR_DEBUG} doesn't exist."
|
||||
fi
|
||||
|
||||
return "${return_is_file_present}"
|
||||
unset local_file_present
|
||||
|
||||
return "${return_is_file_present}"
|
||||
}
|
||||
# }}}
|
||||
is_file_similar() { # {{{
|
||||
|
@ -324,6 +333,9 @@ ${local_similar_file_one} and ${local_similar_file_two} are ${RED}NOT${COLOR_DEB
|
|||
return_is_file_similar="1"
|
||||
fi
|
||||
|
||||
unset local_similar_file_one
|
||||
unset local_similar_file_two
|
||||
|
||||
return "${return_is_file_similar}"
|
||||
}
|
||||
# }}}
|
||||
|
@ -344,6 +356,8 @@ Error in 'mkdir' command for ${RED}${local_directory}${COLOR_DEBUG} directory."
|
|||
return_create_directory="1"
|
||||
fi
|
||||
|
||||
unset local_directory
|
||||
|
||||
return "${return_create_directory}"
|
||||
}
|
||||
# }}}
|
||||
|
@ -374,12 +388,16 @@ Successfully remove permissions for group and other on ${RED}${local_directory}$
|
|||
Error in 'chmod' command for ${RED}${local_directory}${COLOR_DEBUG} directory (user: ${local_username})."
|
||||
return_fix_directory_permissions="1"
|
||||
fi
|
||||
## }}}
|
||||
else
|
||||
debug_message "fix_directory_permissions − \
|
||||
Error in 'chown' command for ${RED}${local_directory}${COLOR_DEBUG} directory (user: ${local_username})."
|
||||
return_fix_directory_permissions="1"
|
||||
fi
|
||||
## }}}
|
||||
|
||||
unset local_directory
|
||||
unset local_username
|
||||
unset local_user_groupname
|
||||
|
||||
return "${return_fix_directory_permissions}"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue