]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
doc: give a tee example for combining process substitution outputs
authorPádraig Brady <P@draigBrady.com>
Fri, 20 Nov 2015 11:54:00 +0000 (11:54 +0000)
committerPádraig Brady <P@draigBrady.com>
Sat, 21 Nov 2015 16:45:18 +0000 (16:45 +0000)
This can be useful if you want to further process data
from process substitutions. For example:
  datagen | tee >(md5sum --tag) > >(sha256sum --tag) | sort

* doc/coreutils.texi (tee invocation): Mention that -p is
useful with pipes that may not consume all data.
Add an example, similar to the one above.
* THANKS.in: Add Jirka Hladky.

THANKS.in
doc/coreutils.texi

index 51c77ef741c229443bcd3bee2c21e9add5a0857c..5c49006a264cb4d001a994b61cd77855771e66e0 100644 (file)
--- a/THANKS.in
+++ b/THANKS.in
@@ -299,6 +299,7 @@ Jesse Thilo                         jgt2@eecs.lehigh.edu
 Jie Xu                              xuj@iag.net
 Jim Blandy                          jimb@cyclic.com
 Jim Dennis                          jimd@starshine.org
+Jirka Hladky                        jhladky@redhat.com
 Joakim Rosqvist                     dvljrt@cs.umu.se
 Jochen Hein                         jochen@jochen.org
 Joe Orton                           joe@manyfish.co.uk
index 8034807a4ecfddf14615eb9eda0225385e355f65..0e28f49718677eb0a283eae4feaf5f892eaefb67 100644 (file)
@@ -13019,6 +13019,11 @@ so it works with @command{zsh}, @command{bash}, and @command{ksh},
 but not with @command{/bin/sh}.  So if you write code like this
 in a shell script, be sure to start the script with @samp{#!/bin/bash}.
 
+Note also that if any of the process substitutions (or piped stdout)
+might exit early without consuming all the data, the @option{-p} option
+is needed to allow @command{tee} to continue to process the input
+to any remaining outputs.
+
 Since the above example writes to one file and one process,
 a more conventional and portable use of @command{tee} is even better:
 
@@ -13087,6 +13092,17 @@ tar chof - "$tardir" \
   | bzip2 -9 -c > your-pkg-M.N.tar.bz2
 @end example
 
+If you want to further process the output from process substitutions,
+and those processes write atomically (i.e., write less than the system's
+PIPE_BUF size at a time), that's possible with a construct like:
+
+@example
+tardir=your-pkg-M.N
+tar chof - "$tardir" \
+  | tee >(md5sum --tag) > >(sha256sum --tag) \
+  | sort | gpg --clearsign > your-pkg-M.N.tar.sig
+@end example
+
 @exitstatus