I have the following series of commands:
cd / && ls | ( cd /tmp && cat >dumpfile)
This series of commands does the following: it creates a file named /tmp/dumpfile
. This file contains a listing of the root directory.
The cd / && ls
output gets piped to a subshell. What I find odd is that in the subshell, instead of cd /tmp
swallowing the ls
output, the later cat >dumpfile
gets it and writes it to a file. What is going on here?