Trying to write a Bash script that will pull all non-admin accounts into an array to which I can then remove the home directories rm -rf /Users/"$USER" and also delete the Sys Pref user dscl . -delete /Users/"$USER".
I can pull all admins with dscl . -read /Groups/admin GroupMembership | grep "$USER" | awk '{ print $3 }' but cannot figure out the command to pull non-admins.
Any help would be amazing!
You might be able to go about this differently.
Use dscl to read all users in the directory and store results
dscl . list /UsersUse your current dscl call to return all admin users. Store results separate from step one