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

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -