PDA

View Full Version : [ubuntu] Help with Shell



DTHCND
August 2nd, 2010, 08:50 PM
Quick question... When you run a shell script using sudo, and there are commands within the script, is the word sudo required when writing the script? What I am trying to do is get a script working but some lines require sudo, but I would prefer if it would work in non debian linux distros...

da burger
August 2nd, 2010, 08:56 PM
If the script is run with root privileges (which it will be if it's prefaced with sudo) all the commands in it will be run as root, meaning they do not need to be prefaced with sudo. (People on other distros will just need to log in as root before running the script)