code cleanup, remove double quotes

This commit is contained in:
Tobias Powalowski 2024-06-08 09:09:49 +02:00
parent 91970c7c29
commit f92fcd9b16

View file

@ -123,7 +123,7 @@ _set_comment() {
} }
_user_management() { _user_management() {
_NEXTITEM="1" _NEXTITEM=1
while true; do while true; do
_DEFAULT="--default-item ${_NEXTITEM}" _DEFAULT="--default-item ${_NEXTITEM}"
#shellcheck disable=SC2086 #shellcheck disable=SC2086
@ -160,9 +160,9 @@ _user_management() {
done done
_dialog --title " Success " --no-mouse --infobox "Default shell set to ${_SHELL}." 3 50 _dialog --title " Success " --no-mouse --infobox "Default shell set to ${_SHELL}." 3 50
sleep 3 sleep 3
_NEXTITEM="2" _NEXTITEM=2
else else
_NEXTITEM="1" _NEXTITEM=1
fi ;; fi ;;
"2") while true; do "2") while true; do
_set_user || break _set_user || break
@ -181,7 +181,7 @@ _user_management() {
_set_password _set_password
_dialog --title " Success " --no-mouse --infobox "User Account ${_USER} created succesfully." 3 50 _dialog --title " Success " --no-mouse --infobox "User Account ${_USER} created succesfully." 3 50
sleep 2 sleep 2
_NEXTITEM="2" _NEXTITEM=2
break break
else else
_dialog --title " ERROR " --no-mouse --infobox "User creation failed! Please try again." 3 50 _dialog --title " ERROR " --no-mouse --infobox "User creation failed! Please try again." 3 50
@ -205,7 +205,7 @@ _user_management() {
elif [[ "${_USER}" = "< Back" ]]; then elif [[ "${_USER}" = "< Back" ]]; then
break break
else else
_NEXTITEM="1" _NEXTITEM=1
while true; do while true; do
_DEFAULT="--default-item ${_NEXTITEM}" _DEFAULT="--default-item ${_NEXTITEM}"
#shellcheck disable=SC2086 #shellcheck disable=SC2086
@ -226,7 +226,7 @@ _user_management() {
"4" "Delete User" \ "4" "Delete User" \
"<" "Return To User Selection" 2>"${_ANSWER}" || break "<" "Return To User Selection" 2>"${_ANSWER}" || break
case $(cat "${_ANSWER}") in case $(cat "${_ANSWER}") in
"1") _NEXTITEM="1" "1") _NEXTITEM=1
if [[ -n "${_ADMIN_ATTR}" ]]; then if [[ -n "${_ADMIN_ATTR}" ]]; then
usermod -R "${_DESTDIR}" -rG wheel "${_USER}" usermod -R "${_DESTDIR}" -rG wheel "${_USER}"
_dialog --title " Success " --no-mouse --infobox "User ${_USER} removed as Administrator and removed from wheel group." 3 70 _dialog --title " Success " --no-mouse --infobox "User ${_USER} removed as Administrator and removed from wheel group." 3 70
@ -236,17 +236,17 @@ _user_management() {
_dialog --title " Success " --no-mouse --infobox "User ${_USER} switched to Administrator and added to wheel group." 3 70 _dialog --title " Success " --no-mouse --infobox "User ${_USER} switched to Administrator and added to wheel group." 3 70
sleep 2 sleep 2
fi ;; fi ;;
"2") _NEXTITEM="2" "2") _NEXTITEM=2
if _prepare_password User; then if _prepare_password User; then
_set_password _set_password
fi ;; fi ;;
"3") _NEXTITEM="3" "3") _NEXTITEM=3
if _set_comment; then if _set_comment; then
usermod -R "${_DESTDIR}" -c "${_FN}" "${_USER}" usermod -R "${_DESTDIR}" -c "${_FN}" "${_USER}"
_dialog --title " Success " --no-mouse --infobox "New comment set for ${_USER}." 3 50 _dialog --title " Success " --no-mouse --infobox "New comment set for ${_USER}." 3 50
sleep 2 sleep 2
fi ;; fi ;;
"4") if _NEXTITEM="4" "4") if _NEXTITEM=4
_dialog --defaultno --yesno \ _dialog --defaultno --yesno \
"${_USER} will be COMPLETELY ERASED!\nALL USER DATA OF ${_USER} WILL BE LOST.\n\nAre you absolutely sure?" 0 0 && \ "${_USER} will be COMPLETELY ERASED!\nALL USER DATA OF ${_USER} WILL BE LOST.\n\nAre you absolutely sure?" 0 0 && \
userdel -R "${_DESTDIR}" -r "${_USER}" &>"${_LOG}"; then userdel -R "${_DESTDIR}" -r "${_USER}" &>"${_LOG}"; then
@ -259,7 +259,7 @@ _user_management() {
done done
fi fi
done done
_NEXTITEM="3" ;; _NEXTITEM=3 ;;
*) break ;; *) break ;;
esac esac
done done