The >&2
redirection is a shortcut for 1>& 2
.
You understand 2>& 1
so you will understand that this links the command's stdout to the current stderr
Footnote about shell redirection syntax...
This looks like
{numfd}[operator]{whitespace}[target]
with the {...}
parts optional. The whitespace between operator and target is recommended for readability, but is not required. On the other hand, if you include the {numfd}
in front of the operator, there can not be any whitespace between the two of them.
[operator]
can be one of <
, >
, >>
for file targets and <&
, >&
for file descriptor targets.
{numfd}
defaults to 0 for <
, 1 for >
and >>
.
[target]
is a filename, unless operator ends in &
. In that case, it is interpreted as a numeric file descriptor.