Order of redirections
81
votes
4
answers
14026
views
I don't quite understand how the computer reads this command.
cat file1 file2 1> file.txt 2>&1
If I understand, 2>&1
simply redirect Standard Error to Standard Output.
By that logic, the command reads to me as follows:
1. concatenate files file1
and file2
.
2. send stdout
from this operation to file.txt
.
3. send stderr
to stdout
.
4. end?
I'm not sure what the computer's doing. By my logic, the command should be
cat file1 file2 2>&1 > file.txt
but this is not correct.
Asked by iDontKnowBetter
(1057 rep)
Apr 30, 2012, 10:28 PM
Last activity: Jan 20, 2025, 01:16 AM
Last activity: Jan 20, 2025, 01:16 AM