Remix.run Logo
jibal 4 hours ago

No, the shell author needed some way to distinguish file descriptor 1 from a file named "1" (note that 2>1 means to write stderr to the file named "1"), and '&' was one of the few available characters. It's not the address of anything.

To be consistent, it would be &2>&1, but that makes it more verbose than necessary and actually means something else -- the first & means that the command before it runs asynchronously.

kazinator 4 hours ago | parent [-]

It's not inconsistent. The & is attached to the redirection operator, not to the 1 token. The file descriptor being redirected is also attached:

Thus you cannot write:

  2 > &1

You also cannot write

  2 >& 1
However you may write

  2>& 1
The n>& is one clump.