diff options
author | Jim Meyering <meyering@redhat.com> | 2007-11-01 21:25:28 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2007-11-01 21:25:28 +0100 |
commit | e556eaa59edf8dfecc763fb13cf288fb1b4d3a40 (patch) | |
tree | 9939e62f736302e9790ecbb8b170639a4e203c84 /doc/coreutils.texi | |
parent | 636f0e101a5e988da9883574f2aba6f6272b16d0 (diff) | |
download | coreutils-e556eaa59edf8dfecc763fb13cf288fb1b4d3a40.tar.xz |
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.
Diffstat (limited to 'doc/coreutils.texi')
-rw-r--r-- | doc/coreutils.texi | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/doc/coreutils.texi b/doc/coreutils.texi index aa25fcd08..9c960a57e 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -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 \ |