Linux pipe and tee with whoPosted: February 19, 2011
Digging in to shell. What i find is may be useful for you guys.
1. Redirection (>) routes the output to the files while pipes ( | ) routes the outputs to other program. But tee command do the both
Problem what i was trying to solve.
Reference: Unix Shell Programming by Yashawant Kanetkar
Output of who Command should be sorted and displayed on the screen along with the total number of users. The same output except the total number of users should also be sorted in file file1
The Answer is :
who | sort | tee /dev/pts/0 file1 | wc -l
/dev/pts/0 is my current tty
May be helpful for you.