bash中的运算符|&是什么意思?

What is the meaning of operator |& in bash?

in Linux bash 我看到脚本使用 |& 运算符,例如:

/opt/program.sh |& tee -a /var/log/program.log

|& 运算符的含义是什么?

此致

根据 §3.2.3 "Pipelines" in the Bash Reference Manual|& 类似于 |,除了:

If ‘|&’ is used, command1’s standard error, in addition to its standard output, is connected to command2’s standard input through the pipe; it is shorthand for 2>&1 |. This implicit redirection of the standard error to the standard output is performed after any redirections specified by the command.

也就是说 — /opt/program.sh 打印到标准输出 到标准错误的任何内容都将通过管道传输到 tee -a /var/log/program.log.