redirection

From: marko2 (marko2_at_REMOVEistop.com)
Date: 09/10/03


Date: Wed, 10 Sep 2003 11:47:09 -0700

Sometimes I just forget how things work.
Assuming that myfile in both situations has something inside of it.

cat <myfile >myfile
cat myfile
(shows an empty file)

wc <myfile >myfile
cat myfile
0 0 0

How does it work does the shell first read ">myfile" and empty it out, or
does the shell read "<myfile" first, give a word count to wc and then empty
it out with >myfile, producing the output 0 0 0



Relevant Pages