1

in Linux bash I see script using |& operator like:

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

What is the meaning of |& operator?

Regards

folow
  • 229
  • 1
  • 5
  • 14

1 Answers1

3

Per §3.2.3 "Pipelines" in the Bash Reference Manual, |& is similar to |, except that:

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.

That is — anything that /opt/program.sh prints to standard output or to standard error will be piped into tee -a /var/log/program.log.

ruakh
  • 175,680
  • 26
  • 273
  • 307