ls | echo
prints just a blank line because echo
reads no input; the last command of the pipeline is actually echo
that prints nothing but a blank line.
Generally:
a | b
makes sure that the output of a
become the input of b
. I suggest you to read the PipelinePipelines
section of man bash
.
If you really want to use ls
and echo
together here's some (pretty useless) examples:
ls | xargs -L 1 echo
echo `ls`
for i in `ls` ; do echo $i ; done