[Mono-dev] excute linux command under mono C#
Alan_Chun
kokolee88 at hotmail.com
Wed Jun 11 10:04:36 EDT 2008
Michael Hutchinson wrote:
>
> On Tue, Jun 10, 2008 at 6:21 PM, Alan_Chun <kokolee88 at hotmail.com> wrote:
>>
>> Hi, any one know how to execute a command, e.g, "stty 9600 -F /dev/ttyS0"
>> under mono C#?
>>
>> string cmd = "stty 9600 -F /dev/ttyS0" ;
>> System.Diagnostics.Process proc = new System.Diagnostics.Process();
>> proc.StartInfo.FileName = ??? //here
>> proc.StartInfo.Arguments = cmd; ////??????
>> proc.StartInfo.UseShellExecute = false; ///????
>> proc.StartInfo.RedirectStandardOutput = true;
>> proc.Start();
>
> Pass your shell command to a shell such as sh or bash:
>
> Filename: "sh" (or "bash")
> Arguments: "-c ' " + your_escaped_command + " ' "
>
> --
> Michael Hutchinson
> http://mjhutchinson.com
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
That's working perfectly. Thanks a lot, Michael.
--
View this message in context: http://www.nabble.com/excute-linux-command-under-mono-C--tp17766078p17778499.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
More information about the Mono-devel-list
mailing list