Summary: In the
bash shell, there is no difference between
&>, but the redirections in the code that you show are different.
In your first piece of code, you use
2>&1 ("redirect standard error to wherever standard output goes").
You then ask why this is not the same as using
&> are the same.
bash documentation that you quote is specifically about the redirection operators
>&word. These are the same as the standard redirection
>word 2>&1, which is also mentioned in the document. Note that there is no mentioning of file-descriptors, the manual does not write
[n]>&word as for some of the other redirection operators (it is unclear what this would mean as the two redirection operators already involves standard input and standard error implicitly).
Only the second of your two commands, the one using
2&>1, is using one of these redirection operators, and it's not interpreted the way you think. The first command
echo abcd 2>&1 is not using the special non-standard redirection
>& since it is immediately followed by a number. The manual makes a special mentioning of this:
When using the second form,
word may not expand to a number or
-. If it does,
other redirection operators apply (see Duplicating File Descriptors below) for
Your second command,
echo abcd 2&>1, is the same as
echo abcd 2 &> 1, i.e. "call
echo with the two arguments
2, and write standard output and standard error to the file called