I am creating a bash script to delete a user account on a mac.
When I pull up terminal and type the commands
sudo dscl . delete /users/username
sudo rm -rf /users/username
It is successful in deleting the desired account and removing the user files.
However, when I create a bash script to do so...
#!/bin/bash
sudo dscl . delete /users/username
sudo rm -rf /users/username
I get the error
delete: Invalid Path
<dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)
Very strange behavior I haven't been able to figure out, although it is likely a simple mistake.
Edit: In my original script, I was doing looping among other things, but for this post I simplified the problem down to a couple of commands wrapped in a bash script.
Thanks for any help.