The "Filename" -
If you put filenames on the command line, a typical UNIX command will read those files. With no filenames, the command will read its standard input. How can you make the command read both files and standard input? Some UNIX systems, and utilities such as gawk (), support a special name like /dev/stdin (). Some older UNIX commands, like cat () and diff (), will accept a "filename" of -
(dash). There's not actually a file named -
; it's just a shorthand for "read standard input."
NOTE: This syntax might change in the future.
For instance, here's how to compare two files on different computers. The rsh
snooze
cat
bin/aprog
command sends a copy of the file bin/aprog from the remote host snooze down the pipe here on the local computer. diff compares the local file aprog.new to the standard input from the pipe:
rsh |
% |
---|
For more examples, see articles and .
- JP