mkuser.sh: folow bash standards

This commit is contained in:
mollusk 2021-10-07 11:07:30 -07:00
parent 9774c9bccb
commit c82ab68762

View File

@ -6,14 +6,14 @@ Create_user(){
echo echo
echo -n "Username: " echo -n "Username: "
read uname read -r uname
echo "Additional Groups: " echo "Additional Groups: "
echo echo
echo "[1] - Arch Linux Defaults" echo "[1] - Arch Linux Defaults"
echo "[2] - Void Linux Defaults" echo "[2] - Void Linux Defaults"
echo "[3] - Custom" echo "[3] - Custom"
read dgroups read -r dgroups
if [ "${dgroups}" = "1" ];then if [ "${dgroups}" = "1" ];then
addgroups="power, wheel, optical network, video, audio, storage" addgroups="power, wheel, optical network, video, audio, storage"
@ -21,16 +21,16 @@ Create_user(){
addgroups="disk,wheel,storage,audio,video,optical,lp,network,dbus,xbuilder" addgroups="disk,wheel,storage,audio,video,optical,lp,network,dbus,xbuilder"
elif [ "${dgroups}" = "3" ];then elif [ "${dgroups}" = "3" ];then
echo -n "Enter desired groups (comma separated): " echo -n "Enter desired groups (comma separated): "
read custgroups read -r custgroups
addgroups="${custgroups}" addgroups="${custgroups}"
fi fi
echo "${addgroups}" echo "${addgroups}"
read -n 1 -p "wait" read -r -n 1 -p "wait"
useradd -m -g users -G "${addgroups}" -s /bin/bash ${uname} useradd -m -g users -G "${addgroups}" -s /bin/bash "${uname}"
passwd "${uname}" passwd "${uname}"
echo echo
if [ -d /home/${uname} ];then if [ -d /home/"${uname}" ];then
echo "User ${uname} created" echo "User ${uname} created"
else else
echo "User creation failed" echo "User creation failed"
@ -40,7 +40,7 @@ Create_user(){
Remove_user(){ Remove_user(){
echo echo
echo -n "Username to delete: " echo -n "Username to delete: "
read duser read -r duser
userdel ${duser} userdel ${duser}
if [ -d /home/${duser} ];then if [ -d /home/${duser} ];then
@ -59,7 +59,7 @@ main(){
echo "[2] - Remove User" echo "[2] - Remove User"
echo echo
echo -n "Choose: " echo -n "Choose: "
read choice read -r choice
if [ "${choice}" = "1" ];then if [ "${choice}" = "1" ];then