cst8102 lab 8 2021.txt - /bin/bash#Lab 8#Jason...

This preview shows page 1 - 2 out of 2 pages.

!/bin/bash #Lab 8 #Jason Monty #036579201 #CST-8102 #310 #Due Date: July 29, 2021 # we used while it is true interact with the menu while [ true ] do echo -e "Choose one of the following options:" echo -e "A to Create a user account" echo -e "B to Delete a user account" echo -e "C to Change supplementary group for a user account" echo -e "D to Change initial group for a user account" echo -e "E to Change default login shell for a user account" echo -e "F to Change account expiration date for a user account" echo -e "Q to Quit" read -p "What would you like to do?: " i if [ $i == "Q" ] || [ $i == "q" ] then exit elif [ $i == "A" ] || [ $i == "a" ] then #Create account with user and home directory and default shell read -p "Enter User name to add: " hdr read -p "Enter User home directory: " dsh read -p "Enter Default shell: " act #creates user and home directory and login shell useradd -m -d $hdr -s $dsh -g sudo $act if [ $? ] then echo "$act User Created successfully!" else echo "$act User Creation failed!" fi #if user wants to delete user elif [ $i == "B" ] || [ $i == "b" ] then read -p "Enter User name to delete: " dact #deletes user deluser --remove-home $dact if [ $? ]

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture