Recently I have had to make some changes on my Macbook that required me to not only have just sudo privileges but root privileges. When I searched how to do this the answer which seemed most appropriate for me was to run the commands I needed to run with root privileges in AppleScript using "with administrator privileges" after the shell script I wanted to run. This accomplished what I needed to do, but in general I would prefer not to have to use AppleScript when I want to run a few commands in the shell.
Therefore, I was wondering what the shell version of "with administrator privileges" is that would work for my mac. I am looking for something that would provide me with not only sudo privileges but root privileges as well. I would prefer it if I could do this in a way that was "sh-compatible" so it would work on zsh, bash, etc. But, I would also accept a solution that only works with zsh (my interactive shell of choice) if there is not a good "sh-compatible" solution for me.
I understand that I can run AppleScripts in the terminal using osascript in a similar vein as the solution provided in How to open a shell script in a new Terminal window and run it with administrator privileges but I was hoping for a more "pure sh" solution if possible.