Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 3 down vote accepted
... | tee /dev/tty | ...

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

share|improve this answer
    
Thank you! This worked perfectly. –  Harv Oct 17 '14 at 19:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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