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
The Brackets means that execute the command in a new bash.It execute the command with the interval of semicolon.Just use the code below instead.
(sudo whoami;sudo whoami)
BYW:the space is not necessary when using '()'.