I'd like to send stdout from one process to the stdin of another process, but also to the console. Sending stdout to stdout+stderr, for instance.
For example, I've got git edit
aliased to the following:
git status --short | cut -b4- | xargs gvim --remote
I'd like the list of filenames to be sent to the screen as well as to xargs
.
So, is there a tee
-like utility that'll do this? So that I can do something like:
git status --short | \
cut -b4- | almost-but-not-quite-entirely-unlike-tee | \
xargs gvim --remote
Best Answer
tee
can duplicate to the current console by usingtee /dev/tty
Alteratively, you can useThis is wrong, read the comments./dev/stdout
or/dev/stderr
but they could be redirected if your command is within a script. Note that/dev/tty
will always be the console (and may not exist in a non-interactive shell).