Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><sup><em>Editor's note</em>:<br> - <code>&gt;(…)</code> is a <a href="http://mywiki.wooledge.org/ProcessSubstitution" rel="noreferrer"><em>process substitution</em></a> that is a <em>nonstandard shell feature</em> of <em>some</em> POSIX-compatible shells: <code>bash</code>, <code>ksh</code>, <code>zsh</code>.<br> - As written, the answer accidentally sends the output process substitution's output through the pipeline <em>too</em>.<br> - <code>echo 123 | tee &gt;(tr 1 a) &gt;(tr 1 b) &gt;/dev/null</code> would prevent that, but it has pitfalls: output from the process subsitutions will be unpredictably interleaved, and, except in <code>zsh</code>, the pipeline may terminate before the commands inside <code>&gt;(…)</code> do.</sup></p> <p>In unix (or on a mac), use the <a href="http://en.wikipedia.org/wiki/Tee_(command)" rel="noreferrer"><code>tee</code> command</a>:</p> <pre><code>$ echo 123 | tee &gt;(tr 1 a) | tr 1 b b23 a23 </code></pre> <p>Usually you would use <code>tee</code> to redirect output to multiple files, but using >(...) you can redirect to another process. So, in general,</p> <pre><code>$ proc1 | tee &gt;(proc2) ... &gt;(procN-1) | procN </code></pre> <p>will do what you want.</p> <p>Under windows, I don't think the built-in shell has an equivalent. Microsoft's <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx" rel="noreferrer">Windows PowerShell</a> has a <code>tee</code> command though. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload