I am working on an assignment on pipes in Linux. I have a program that prints
./a ls | wc
0 2 11
Because your program takes no arguments, the fact that you passed it
ls as an argument makes no difference to its output: It's ignoring that argument and still emitting
hello world, just as it would if
ls had not been passed on its argument list.
Understand that a pipeline sets up a FIFO -- that is, it connects two programs.
./a ls ## this program's output... wc ## ...is connected to this program's input.
The pipeline is thus not an argument to
a; it's an instruction to the shell about how to route the output of
a, in this case an instruction to route it into the stdin of