I am trying to save a users home directory to a users.txt file, but I just keep saving my own. The script asks the user to enter their username, which I have saved in $username. When I runls ~ >> users.txtIt shows ls home/student/am1014 (which is my username)I assume I need to use sudo to store it but I'm not sure how.
Sudo as another user to save their home directory address to a txt file
scripting;sudo;users