I tried to find information about the operator order in the statement
>&/dev/null
Is there any difference between >& and &>?
I tried to find information about the operator order in the statement
>&/dev/null
Is there any difference between >& and &>?
According to the manual 3.6.4 Redirecting Standard Output and Standard Error:
3.6.4 Redirecting Standard Output and Standard Error
This construct allows both the standard output (file descriptor 1) and the standard error output (file descriptor 2) to be redirected to the file whose name is the expansion of word.
There are two formats for redirecting standard output and standard error:
&>wordand
>&wordOf the two forms, the first is preferred. This is semantically equivalent to
>word 2>&1When 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 compatibility reasons.
>&/dev/nulland&>/dev/null, but there's a hell of a difference between>&pathand>&number(as the OP's>&/dev/nulland the>&2you point to). You can find better duplicates by searching for>&with meta.stackexchange.com queries. – Jan 19 '21 at 23:00