]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Say that the first process substitution example is contrived.
authorJim Meyering <meyering@redhat.com>
Thu, 1 Nov 2007 20:25:28 +0000 (21:25 +0100)
committerJim Meyering <meyering@redhat.com>
Thu, 1 Nov 2007 20:25:28 +0000 (21:25 +0100)
* doc/coreutils.texi (tee invocation): ... and show how to do
it properly.  Pointed out by James Antill.

ChangeLog
doc/coreutils.texi

index cfb5c79cbab26f8573307f60b24e17a8d1f1db5c..e39c84e3c16de5a0bae7962bf32fc242a218c02c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2007-11-01  Jim Meyering  <meyering@redhat.com>
 
+       Say that the first process substitution example is contrived.
+       * doc/coreutils.texi (tee invocation): ... and show how to do
+       it properly.  Pointed out by James Antill.
+
        Use mktemp, not mkdtemp, to create test directories.
        * tests/test-lib.sh: Use the mktemp binary we've just built,
        not the mkdtemp script.
index aa25fcd080384432a104366c46eabad3b25bdacb..9c960a57e0be82eac2594bab6ef7ce781d913734 100644 (file)
@@ -11076,6 +11076,7 @@ and SHA1 computation.  Then, you'll get the checksum for
 free, because the entire process parallelizes so well:
 
 @example
+# slightly contrived, to demonstrate process substitution
 wget -O - http://example.com/dvd.iso \
   | tee >(sha1sum > dvd.sha1) > dvd.iso
 @end example
@@ -11093,8 +11094,17 @@ 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}.
 
+Since the above example writes to one file and one process,
+a more conventional and portable use of @command{tee} is even better:
+
+@example
+wget -O - http://example.com/dvd.iso \
+  | tee dvd.iso | sha1sum > dvd.sha1
+@end example
+
 You can extend this example to make @command{tee} write to two processes,
-computing MD5 and SHA1 checksums in parallel:
+computing MD5 and SHA1 checksums in parallel.  In this case,
+process substitution is required:
 
 @example
 wget -O - http://example.com/dvd.iso \