I wanted to know the difference between the following two commands

2>&1 | tee output.log


|& tee output.log

Looking for pipes to save command's output I've reached this explanation. I've been using the former, but now I wonder if the latter saves typing with same result or there's something I don't understand (or I don't know).



man bash

If |& is used, command'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 |.

So no difference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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