I need a script to either delete last logged on user or delete all users except for local admins (I figured last logged on user was the safest). I do not need to delete the home folder just the user account. I have tried to build the script unsuccessfully due to being new to the Mac OS.
Solved
Script to delete last logged in user or delete all users except for admins

Best answer by talkingmoose
Sorry, Ryan! Try this line instead:
if [ $TESTLOCALADMIN = "" ] ; then
Or this:
if [ -z "$TESTLOCALADMIN" ] ; then
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.