Use sudo -i in bash script
How about something simple like this.
#!/usr/bash
sudo bash << EOF
# Everything until EOF is run in a sub-shell
echo 'Hello World'
whoami
EOF
Here is a simpler approach:
#!/usr/bash
sudo sh another_script.sh
<continue some other task>
Here is the other script.
#!/usr/bash
<multiple line perform all my sudo command>
...
...
...
If you want to avoid prefixing each command with sudo
, you can just include them in another script and call it.