Redirecting sh output to a pipe
I want to redirect the output of a 'sh' shell to a socket, from a C program. I have a big problem: nothing appears!. I mean, when I redirect the output of, for example, a 'ls' command, it works just fine; but when I try it with 'sh' it doesn't.
I thought this was because 'sh' also opens STDIN at start, and that may be screwing pipes up. So I closed them ( close(0); ), but it still didn't work.
Can someone point out why I can get things right?
Last edited by elmafiacs; 05-10-2006 at 02:03 PM.
|