------------------------------------------------------------------------
tee
------------------------------------------------------------------------

tee allows you to write to a file (or files) and still pass the input stream to
the terminal. The usage is "| tee" always.



$ ls | tee file

results in the list of files in current directory written to "file" and also displayed on terminal. Thus,

$ ls | tee file | wc -l
will result in "file" and also list the number of files being displayed. You can be fancier
$ echo "number of files:" $(ls | tee file | wc -l)

$ ls | tee a b c
will result in the input stream written to three files, "a", "b" and "c"

$ ls | tee -a b
will append the input stream to file "b"