ProAnswers.org

What does the command “ $who | sort –logfile > newfile” do?

The input from a pipe can be combined with the input from a file . The trick is to use the special symbol “-“ (a hyphen) for those commands that recognize the hyphen as standard input.

In the above command the output from who becomes the std input to sort , meanwhile sort opens the file logfile, the contents of this file is sorted together with the output of who (rep by the hyphen) and the sorted output is redirected to the file newfile.