I've been getting myself comfortable with I/O redirection. I've become aware of the
&> shortcut for
2>&1. I believe it also works as
>&. There may be a nuance to that of which I'm not aware.
When using this it has to be in the middle of a command line:
ls test.txt missing &> output.txt
However, when using the long-form, it has to be at the end of the command line:
ls test.txt missing > output.txt 2>&1
When attempting to place the shortcut at the end it results in an error:
ls test.txt missing > output.txt &> -bash: syntax error near unexpected token `newline'
Why is this? What makes the shortcut different such that it has to be used inline rather that at the end of the line the same way the long-form method does?