If I call a bash script with sudo, for example:
sudo bash script.sh
Do I still have to use sudo inside the script in cases like this:
sudo apt-get update
|
If I call a bash script with
Do I still have to use
|
||||
|
No. the command will be run with root privileges and all commands that the script runs will inherit the privileges. |
|||
|
|
|
no, by calling sudo you are running a process in kernal mode which means you have access to everything, you no longer have to use special permissions in different areas of your code/script. |
|||
|
sudocan't find thechmodcommand. Unless the command in the script issudo "chmod +x /usr/bin/apt-fast", which would causesudoto look for a command named"chmod +x /usr/bin/apt-fast". (But in any case, you don't needsudoinside the script.) – Keith Thompson Aug 9 '11 at 19:49$PATH. – Keith Thompson Aug 9 '11 at 20:30