What I mean is, can I use fork() and exec() to implement calls like:
ls -l | wc | wc , where I have used 2 pipes.
Asked
Active
Viewed 240 times
0
dbush
- 186,650
- 20
- 189
- 240
user287924
- 1
- 1
-
YEs, you can. The shell is written in C, and it does it. – Barmar Sep 17 '15 at 21:17
-
Call `pipe` twice to set up the two pipes, call `fork` three times, connect all the pipes to the appropriate `stdin` and `stdout` with `dup2`, and then `exec` the programs. – Barmar Sep 17 '15 at 21:19
1 Answers
0
-
If you're just going to refer him to another question, vote to close as a duplicatae. – Barmar Sep 17 '15 at 21:22
-