I have a shell script in which most of the commands need to be run under sudo; however, the last few commands need to be run as the current user. Is there a way I can exit sudo and switch to the currently logged in user?
If I was running it all from the command line, I could do something like:
sudo su [su commands] exit [user commands]
exit will stop the script at that command.