I\'m writing a bash script that needs to sudo multiple commands. I can do this:
( whoami ; whoami )
but I can\'t do this:
sudo
for example try this, I tested it:
sudo bash -c "cd /;ls;ls|grep o"
In this example you first change dir to /root, next list root directory and finally for root directory filter only directories having name with letter 'o'.
But i thing better way is writting script that do all you need and give exitcode for all complex action. Then you can sudo script instead group of single commands like example above.