cat f_1 > f_2 > f_3
in f_1 :: hey , hi
but after cat f_1 > f_2 > f_3 f_1 = hey , hi f_2 has nothing , why f_3 = hey , hi |
I'm not really familiar with the input/output redirection mechanism so I can't say why the content is going into f_3 instead of f_2, but if you want to 'cat' the contents of f_1 to f_2 and f_3, you can use
Code:
cat f_1 | tee -a f_2 > f_3 |
Think of each > as a number (as it is assigned a file descriptor). Seeing as you used the same number both times, only the final file will receive the data. This is a simple definition.
|
You can't redirect the same output to multiple files at the same time. There's only one stdout, so there's only one place it can go. Use tee, as shown above, to duplicate the output.
I believe in the above that the shell first sets up the "> f_2" redirection, then immediately replaces it with the "> f_3" redirection, clearing the first one. |
All times are GMT -5. The time now is 07:01 AM. |