- Most of us know that to redirect STDERR to STDOUT we do
2>&1 - We also know about redirecting FILE with "
>" and redirecting processes with " |"
What I was always interested in was the combination of the two
If you want to redirect STANDR and STDOUT from prog1 to prog2 , you put 2>&1before the tag |prog2. On the other hand, if you redirect STDERR and STDOUT prog1 to a file (file.txt), 2>&1comes after > file.txt.
So, I know HOW to do this, Iām just wondering WHY this is done so. This seems inconsistent to me, but I may not look at it correctly.
thank
source
share