There is a list of teams that succeed only if preceded by them sudo.
There is another list of commands that are executed only when the user runs them without sudo.
I want to execute all these commands from the same script.
I would like to avoid having to do the following:
#!/usr/bin/env bash
sudo sudo_command_one;
sudo sudo_command_two;
sudo sudo_command_three;
non_sudo_command;
sudo sudo_command_four;
The reason for this is that sudo has a timeout, and these commands are likely to take a lot of time. I don’t want to be burdened with having to re-enter my sudo password. I could extend the sudo timeout indefinitely, but this is also something that I would prefer to avoid if there is an easier way.
Therefore, I am going to run the script as follows:
sudo ./script
non-sudo.
:
#!/usr/bin/env bash
sudo_command_one;
sudo_command_two;
sudo_command_three;
[turn sudo off for a moment]
non_sudo_command;
[ok, turn sudo back on]
sudo_command_four;
, , sudo, , sudo ( ).