13.10 How to tee Several Commands Into One FileThe tee (13.9 ) command writes its standard input to a file and writes the same text to its standard output. You might want to collect several commands' output and tee them all to the same file, one after another. The obvious way to do that is with the -a option: $ A more efficient way is:
The subshell operators (13.7 ) collect the standard output of the three commands. The output all goes to one tee command. The effect is the same - but with two fewer pipes, two fewer tee s, and one more subshell. Unfortunately, the C shell doesn't make this quite as easy. If you can type all the commands on one line, you can do it this way (the same thing works in the Bourne shell): % Otherwise, use a semicolon and backslash ( % - |
|