For your command you also could refer to the following example:
sudo sh -c 'whoami; whoami'
More Related Contents:
- sudo echo “something” >> /etc/privilegedFile doesn’t work [duplicate]
- How do I use su to execute the rest of the bash script as that user?
- Root user/sudo equivalent in Cygwin?
- How can I execute a bash function using sudo?
- Why does shell ignore quoting characters in arguments passed to it through variables? [duplicate]
- How can I use a file in a command and redirect output to the same file without truncating it?
- How to check if a variable is set in Bash
- Why does a space in a variable assignment give an error in Bash? [duplicate]
- Shell equality operators (=, ==, -eq)
- What is a simple explanation for how pipes work in Bash?
- Indirect variable assignment in bash
- redirect COPY of stdout to log file from within bash script itself
- Shell script to delete directories older than n days
- How to recursively find the latest modified file in a directory?
- How to extract directory path from file path?
- Quick-and-dirty way to ensure only one instance of a shell script is running at a time
- Process all arguments except the first one (in a bash script)
- How to represent multiple conditions in a shell if statement?
- Generating permutations using bash
- What does the Bash operator
- Value too great for base (error token is “09”)
- How to escape history expansion exclamation mark ! inside a double quoted string?
- firebase-tools “-bash: firebase: command not found”
- What does “plus colon” (“+:”) mean in shell script expressions?
- Running shell command that has nested quotes via ssh
- Run a shell script and immediately background it, however keep the ability to inspect its output
- How do I get both STDOUT and STDERR to go to the terminal and a log file?
- How to append a string at end of a specific line in a file in bash [duplicate]
- docker entrypoint running bash script gets “permission denied”
- What does `kill -0 $pid` in a shell script do?