I am reading this documentation which gives the following examples about redirection and file descriptors.
ls > dirlist 2>&1
will direct both standard output and standard error to the file dirlist, while the command
ls 2>&1 > dirlist
will only direct standard output to dirlist. This can be a useful option for programmers.
Are these examples the wrong way round? It seems to me the second example "will direct both standard output and standard error to the file dirlist" while the first example "will only direct standard output to dirlist".
If I'm wrong about this (...probably...) can someone explain the logic of these 2 examples clearly?