1

I am wondering if a Mono C# application running in Ubuntu can somehow run a terminal command. For example, could the user give the program his or her password and then have the application run

sudo apt-get install application-name

(console requests password)

password

(console requests confirmation)

y 

Preferably, this would be done without actually opening a terminal visible to the user, so that the application could provide the necessary feedback and manage the whole operation cleanly with as little user interaction as possible.

Is there a way to do that? If so, how? Let me know if clarification is needed. Thank you!

1 Answer 1

3

Should be possible, you would just redirect the password to the StandardInput stream of the Process class.

Sign up to request clarification or add additional context in comments.

2 Comments

I am more specifically asking how to run commands with C#. The password situation is just an example. How can the program run a command? Thank you.
@Razick please read the answer again :-) You use the Process class for this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.