Need to call unix shell script from a Net assembley, how would I do it.. and return tabular result(key value pair(s)) to the caller.
A:
Assuming you are running your code in Mono on Linux, you should be able to do something like this:
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "myscript.sh";
proc.Start();
I see you have now added that you need to be able to parse the output from the shell script. Take a look at this more complex example that shows how to get the output of the script.
It is hard to give advice on how to actually parse the output, as you don't give us an example of what the output looks like.
andynormancx
2010-02-11 14:10:05
He'd also have to redirect StandardInput in order to get the tabular result back to the caller.
Nick
2010-02-11 14:24:59
There wasn't any mention of getting the results back when I posted my answer...
andynormancx
2010-02-11 14:26:44
Sorry that I forgot to mention..
TonyP
2010-02-11 15:03:59