Exercise 2 : Pipe in shell
Execrise-2 : Modify pipe4.c
, make it accept two inputs from command line and pipe them. Your program should run like this ./pipe4 [command1] [command2]
. You can assume that command1
and command2
do not have parameters.
when you run your program as ./pipe4 ls less
, the result should be the same with running ls | less
in shell. If you have installed fortune
and cowsay
, you may run your program like ./pipe4 fortune cowsay
. Interesting result you may see as the picture below.