LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to use su with arguments? (https://www.linuxquestions.org/questions/linux-software-2/how-to-use-su-with-arguments-884046/)

Red Squirrel 06-01-2011 08:53 PM

How to use su with arguments?
 
How to I use su to run a command, and pass arguments to that command, and not su?

ex:

Code:

su vmuser VBoxManage -q list runningvms
I want -q to be specified to the VBoxManage command, not su. If I try any type of quotes it does not work either. Is there a way to do this?

TobiSGD 06-01-2011 08:58 PM

The correct way would be
Code:

su vmuser -c 'VBoxManage -q list runningvms'
You need the -c option to run commands with su.

For more information about the usage of su have a look at
Code:

man su

Red Squirrel 06-01-2011 09:07 PM

Ahh I see, that worked, thanks!

TobiSGD 06-01-2011 09:12 PM

If your problem is solved please mark this thread as solved using the thread tools at the top of this thread.


All times are GMT -5. The time now is 05:23 AM.