Apart from its use in redirection, /dev/tty can also be used as an argument to some commands.

Phạm Quyết

New member
Apart from its use in redirection, /dev/tty can also be used as an argument to some commands.
A. True
B. False
 
Answer: a
Explanation: /dev/tty can be used as an argument to some UNIX commands. Because the terminal is also a file we can use the device name /dev/tty as an argument to some commands like tee. For example,
Code:
$ who  |  tee  /dev/tty  | wc  -l            // same as who | wc  -l
In the above command, tee saved the output of who in /dev/tty, thus effectively showing it on the screen and wc -l counted the number of lines from another stream.
 

Tìm kiếm

Back
Top