[MonoDevelop] How to run a bash terminal command from Mono/MonoDevelop in Linux?

Ian Norton ian.norton-badrul at thales-esecurity.com
Tue Jul 29 17:22:06 UTC 2014


What platform?

On 29 July 2014 18:07:32 BST, Hari <phariparam at gmail.com> wrote:
>I want to run the following bash command programmatically using C# and
>MonoDevelop and store the output to a variable.
>
> 
>
>./TestApp  --H
>
> 
>
>My MonoDevelop/C#  code is as follows: 
>
> 
>
>Process proc = new Process();
>
>proc.StartInfo.FileName = "/bin/bash";
>
>proc.StartInfo.Arguments = "./usr/mono/TestApp --H";
>
>proc.StartInfo.UseShellExecute = false; 
>
>proc.StartInfo.RedirectStandardErrort = true;
>
>proc.StartInfo.RedirectStandardInput = true;
>
>proc.StartInfo.RedirectStandardOutput = true;
>
>proc.Start();
>
>string value = proc.RedirectStandardOutput.ReadToEnd()
>
> 
>
> 
>
>The below line displaying the error “System.InvalidOperationException:
>No process is associated with this object
>
> 
>
>Process proc = new Process();
>
> 
>
>Thank You
>
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monodevelop-list/attachments/20140729/3e6518b3/attachment.html>


More information about the Monodevelop-list mailing list