bash 中 &> 和 >& 有什么区别?

Jok*_*ter 33 linux bash redirection

bash&>>&bash 有什么区别?

tldp没有提到后者。真的是重定向操作符吗?

或者有人知道更完整的教程吗?

小智 43

bash man页面:

There  are  two  formats  for  redirecting standard output and standard
   error:

          &>word
   and
          >&word

   Of the two forms, the first is preferred.  This is semantically equiva-
   lent to

          >word 2>&1
Run Code Online (Sandbox Code Playgroud)

阅读redirection sectionbash 手册页的 。


Kus*_*nda 8

在 bash 中,>&word&>word(首选语法)将标准输出和标准错误重定向到同一位置。这相当于>word 2>&1. 在bash 手册中查找。


Red*_*ick 5

man bash

重定向标准输出和标准错误有两种格式:

       &>词
和
       >&word

在这两种形式中,首选第一种。这在语义上是等价的
借给

       >单词 2>&1