I would like to enable sudo within this bash function mid-script. I believe the issue is that sudo -s
opens up a new shell, and all subsequent lines aren't printed because the shell is exited.
function example {
echo "one"
sudo -s
echo "two"
echo "three"
}
How can I have two
and three
also get printed as sudo? Without adding sudo
before each?