How to get return value of shell command in Mono C# -


i want know how interact shell mono , can't seem find information this. example, want return output of "ls" , stick variable - possible?

here's have far:

        var proc = new process();         proc.startinfo.filename = "ls";         proc.start ();         proc.close () 

it possible shell output. please try following -

process p = new process(); p.startinfo = new processstartinfo("/bin/ls",  "-l")                    {                      redirectstandardoutput = true,                      useshellexecute = false                    }; p.start(); p.waitforexit(); //the output of shell command in output variable after  //following line executed var output = p.standardoutput.readtoend(); 

Comments

Popular posts from this blog

java - Ebean enhancement ignores a model -

ubuntu - How to disable Kernel Module Signing in linux -

SQL php on different pages to Insert (mysqli) -