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

1 Answer 1

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.