Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tee can be used to duplicate stdout to stderr #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

frederic-mahe
Copy link

It took me a while to figure it out. As it might be useful for someone else, I propose to add it here.

It took me a while to figure it out. As it might be useful for someone else, I propose to add it here.
@pkrumins
Copy link
Owner

Can you show an example here?

@frederic-mahe
Copy link
Author

Sure:

echo "Foo" | tee /dev/stderr

will print "Foo" twice (on stdout and stderr). I reviewed a script in which the same message was echoed twice: once to the stdout, and a second time to the stderr. To remove that code duplication, I proposed to use the tee command. In my opinion, the interesting reminder here is that you can tee to a file, but also to any other device.

@pkrumins
Copy link
Owner

Cool example! I need to see how it looks in the final cheat sheet. It's tight on space for more examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants