Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Unix%20Interview%20Questions%20and%20Answers

Question: What does the command ? $who | sort ?logfile > newfile? do?
Answer: 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 std 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.
Is it helpful? Yes No

Most helpful rated by users:

©2024 WithoutBook