Redirect output to stdout and pipe to a binary

command lineio-redirectionpipetee

I have a nice PS1 line in my .bash_profile, and I want to copy it to another machine. So I want to view it AND copy it to my clipboard. I can't figure out how to string the commands to do this together.

I imagine what I need to do is grep for my PS1 line, pipe that to tee, then tee goes to stdout and also to pbcopy (binary to copy the line to my clipboard).

So far I have:

grep PS1 .bash_profile | tee [what do I put here?] | pbcopy

and unfortunately I'm just confusing myself, can't figure out how to do this.
How do I output to stdout AND to a binary at the same time?

Best Answer

... | tee /dev/tty | ...

/dev/tty is the "file" that refers to your terminal.

Related Question