What does the ampersand indicate in this bash command 1>&2

后端 未结 6 1464
慢半拍i
慢半拍i 2020-12-23 16:43

Quick one, 2>&1 redirects stderr to stdout, but what does the ampersand mean? I know if we had 2 > 1 it would output to a file named

6条回答
  •  萌比男神i
    2020-12-23 17:11

    It copies file descriptor 1 to file descriptor 2. FD2 is stderr and FD1 is stdout, so it makes any output to stderr go to stdout instead.

提交回复
热议问题