How `command> file 2> & 1` differs from` command 2> & 1> file`

As the title says, why are the two teams different? I see how they are different by simply typing them into the terminal, but I'm confused, why? For me, the second command seems to be a more intuitive way of achieving what is achieved by the first; i.e. stderr is commandredirected to stdout, and then stdout from is commandredirected to file. At least reading from left to right is what should happen. However, obviously, the redirection order is not as simple as reading from left to right. Can anyone explain this? Thanks.

+4
source share

Source: https://habr.com/ru/post/1620471/


All Articles