[Mono-dev] starting process in Linux environment

Robert Jordan robertj at gmx.net
Tue Feb 21 13:43:53 UTC 2012


On 21.02.2012 14:39, Robert Jordan wrote:
> On 21.02.2012 13:36, pattex007 wrote:
>> Hi
>>
>> i'm trying to start a proces in linux but it fails.
>>
>> the problem is the process argument, it doesnt recognize it.
>> Process procNetAdapters = new Process();
>>
>> ProcessStartInfo startInfo = new ProcessStartInfo("ifconfig");
>> startInfo.Arguments = "| grep 'inet addr:'";
>
>
> Pipes are a shell feature. You can only use them as arguments
> to ProcessStartInfo if the process you're trying to start
> is the shell itself:
>
> ProcessStartInfo startInfo = new ProcessStartInfo("/bin/bash");
> startInfo.Arguments = "-c '| grep \\'inet addr:\\''";

Correction:

startInfo.Arguments = "-c 'ifconfig | grep \\'inet addr:\\''";

Robert



More information about the Mono-devel-list mailing list