NAME 

tpipe - duplicate standard input and/or standard ouput

SYNOPSIS 

tpipe string tpipe [-h|--help|--usage] [-v|--version]

DESCRIPTION 

tpipe is the tool to connect different command pipelines. It works in a similar way to tee(1) but the recipient is not a file: The string argument given to tpipe must be an 'adequately quoted' command or pipeline of commands. Beware it will be executed in a subshell by sh(1) regardless of the shell from which tpipe is invoked.

Unlike other implementations, this one adheres strictly to sound operative system standards in that there is no more than one possible standard output at any given time.

OPTIONS 

-h, --help, --usage
display this help and exit
-v, --version
output version information and exit

EXAMPLES 

1- Duplicate standard output by redirecting it to a file through another pipe:

$ command1 | tpipe 'pipeline > file' | command2

command1 --> tpipe -------> command2 | --> pipeline --> file

2- Reinject the other pipe output into standard output by simply NOT redirecting:

$ pipeline1 | tpipe "pipeline2" | pipeline3

pipeline1 ------------------> pipeline3 | ^ | | --> pipeline2 -

Expect UNDETERMINED final results, but it is assumed this is what you want:

Depending on which one is executed faster, pipeline3 will collect pipeline2's output before, after, or while receiving that of pipeline1.

tpipe does its best to keep balance on both outputs, therefore maximizing in fact the a-priori chance of receiving them interspersed.

3- Inject into a pipeline data from an independent origin:

$ cat wordlist1 | tpipe "cat dictionary2" >> passwords

cat wordlist1 -----------> passwords / cat dictionary2 ---

Same comment made for the previous example applies here, so you know all outputs will be collected in the end, only you don't know beforehand the order in which they will arrive.

Again, it is presumed that you don't care or even that this is precisely what you want, or you would rather be using more traditional things like:

$ cat wordlist1 >> passwords $ cat dictionary2 >> passwords

4- Multiple instances:

$ ...| tpipe "echo world" | tpipe 'echo hello' |...

tpipe '...'-- | v tpipe '...'-- | v command1 -------> command2 ^ | tpipe '...'-- ^ | tpipe '...'--

5- Nesting:

$ ...| tpipe "echo world | tpipe 'echo hello'" |...

Note the subtle difference from the previous example.

6- No operation:

$ ...| tpipe '' |...

would be tantamount to ...| cat |...

7- Environment variables as shell macros:

$ PIPE1='cat > textfile'; PIPE2='sort | uniq' $ ... | tpipe $PIPE1 | eval $PIPE2 | ...

would be equivalent to: $ ... | tpipe 'cat > textfile' | sort | uniq | ...

which would -in turn- be equivalent to: $ ... | tee textfile | sort | uniq | ...

EXIT STATUS 

Nonzero in case the subpipe could not be opened. (Note this is different from unsuccesful execution of the subpipe). Standard output is always delivered by this implementation of tpipe regardless of what happens with the subpipe.

BUGS 

tpipe is considered unorthodox.

REPORTING BUGS 

Report bugs to <juanjo@eurogaran.com>.

COPYING 

Copyright © 2003 Juanjo Garcia <juanjo@eurogaran.com>

This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.

Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be included in translations approved by the Free Software Foundation instead of in the original English.

AUTHORS 

Written by Juanjo Garcia.

HISTORY 

1990 - The first tpipe tool was originally conceived, written and put in the public domain by David B Rosen <rosen@bucasb.bu.edu> for the HP-UX 10.10 system. See: <, < http://bak-px.online.sh.cn/mirrors/hpux.freeware/Users/tpipe-1.0/>.

Nov 1 2003: Completely rewritten from scratch under the terms of the GNU General Public License by Juanjo Garcia <juanjo@eurogaran.com>

SEE ALSO 

tee(1), cat(1), mkfifo(1), sh(1) or bash(1).