How can I address the standard filehandles (stdin and stdout) on the command line?
• A: You might need this to copy a part of your directory tree to another location using tar. Depending on the semantics, a single dash is interpreted as the respective standard channel. Example: $ tar cf – . | (cd somewhere_else; tar xvf -) Here we write everything in and below our current directory in tar format to the standard output which is connected to a nameless pipe, which in turn is connected to another tar which reads from stdin. “Depending on the semantics” means, if you tell tar to read, the dash is interpreted as stdin, whereas if you tell tar to write, the dash is interpreted as stdout. The parentheses are necessary to let the tar on the right side of the pipe access this pipe as the reader. Otherwise, cd would be the reader which is no very useful.