Wye

wye is little utility that expands the concept of pipes to direct the standard input stream to two processes simultaneously rather than just one. To use it, you just pipe your initial program into wye, and specify the where you want wye to send the output to on the command line.

As an example, let's say you wanted to both compile a C source file and count the number of lines in it. You could do them sequentially if you wanted, but using wye you can do these tasks simultaneously:
$ cat foo.c | wye "wc -l" "gcc -xc -o foo.o -c -"

In practice, this is a bit of a contrived example (see below): no matter how long your file might take to compile, the word count will probably run in almost an instant, so you can do the wc first and then run gcc and let it go. But it is indeed useful if you have two tasks that you want to run on the same input and both of them are likely to take a while, especially if the input data itself is dynamically generated rather than coming from a static file.

I wrote wye because I expect it to come in handy in a future project of mine (a multi-stage gravitational simulation engine, which works by piping the output from one stage into another)--I haven't had any real use-cases where wye would be ideal just yet myself, which is why the example above is so contrived. If you have a more realistic example, I'd love to use it instead (and you'll be credited!).

I would be glad to hear of any bugs you might find. You can send bug reports, bug fixes, feature requests, and other patches to me at kmw@kurtweber.us. I can't guarantee I'll necessarily include them in a future release, but you are of course welcome to create and distribute your own fork. I'm especially interested in improvements to the option-handling code, which at present works but sucks. I'm a good enough programmer to make things do what I want to do, but I'm not necessarily good enough to do it in the best way possible (I'm getting better, though :) ).

Full documentation is available in a manual page included with the distribution, and (once you've installed it) quick help can be accessed with wye -h.


Download

You can download the current release of wye (0.1) from my FTP server:

wye is released under the GNU General Public License, version 3.

I hope to have Slackware packages soon. If you're not using Slackware, well, you should really be using Slackware. If you're stubborn and still aren't, that's what the source packages are for (or third-party binary packages, in the highly unlikely event that this utility becomes popular enough that someone actually bothers to make some).


I hope you find this useful.

Kurt M. Weber (kmw@kurtweber.us), 10 May 2013