Chris's Wiki :: blog/unix/ProcessSubstitutionWhyLate Commentshttps://utcc.utoronto.ca/~cks/space/blog/unix/ProcessSubstitutionWhyLate?atomcommentsDWiki2022-01-07T22:10:29ZRecent comments in Chris's Wiki :: blog/unix/ProcessSubstitutionWhyLate.By mef on /blog/unix/ProcessSubstitutionWhyLatetag:CSpace:blog/unix/ProcessSubstitutionWhyLate:f33d4aa088a231acdfb9322c1bf8390ff49e315emef<div class="wikitext"><p>W. Richard Stevens writes in "Advanced Programming in the UNIX Environment":</p>
<p>"The /dev/fd feature was developed by Tom Duff and appeared in the 8th Edition of the Research Unix System. It is supported by SVR4 and 4.3+BSD. It is not part of POSIX.1"</p>
<p><a href="https://www.informit.com/articles/article.aspx?p=99706&seqNum=15">https://www.informit.com/articles/article.aspx?p=99706&seqNum=15</a></p>
</div>2022-01-07T22:10:29ZBy Opk on /blog/unix/ProcessSubstitutionWhyLatetag:CSpace:blog/unix/ProcessSubstitutionWhyLate:a7fe7c851ab6b80aa80e14a0cc4970b9d20906d3Opk<div class="wikitext"><p>Rather than a raw temporary file, the concept can also be implemented with mkfifo/mknod which gives you a named on-disk temporary pipe but allows asynchronous reading/writing between two processes. Even now, it works that way in zsh on systems lacking <code>/dev/fd</code> and I remember using it on IRIX and AIX back in the early/mid-'90s at a time when as far as I could tell it was a feature unique to zsh. Even then, zsh had an additional form using <code>=(...)</code> which does use a temporary file and is useful for commands like diff that do need to seek within files. There's also <code>>(...)</code> for writing, both in bash and zsh. I can't tell you how far back named fifos go on Unix but it is definitely longer than <code>/dev/fd</code>. The first systems where I was aware of the latter feature would have been Solaris.</p>
</div>2022-01-04T18:27:20ZBy Carl on /blog/unix/ProcessSubstitutionWhyLatetag:CSpace:blog/unix/ProcessSubstitutionWhyLate:ae3d10a4d79435a95e2aaa433ad9dd7201269a18Carlhttps://blog.carlmjohnson.net<div class="wikitext"><p>Incidentally, process substitution in Fish [the shell for the 90s ;-) ] is still incomplete because it cannot pipe into a process: <a href="https://github.com/fish-shell/fish-shell/issues/1786">https://github.com/fish-shell/fish-shell/issues/1786</a></p>
</div>2022-01-04T04:23:13ZBy Anonymous on /blog/unix/ProcessSubstitutionWhyLatetag:CSpace:blog/unix/ProcessSubstitutionWhyLate:dbfe984365d397826fd1c707f48a4b9a92267ea4Anonymous<div class="wikitext"><blockquote><p>I don’t know if all that is still the case.</p>
</blockquote>
<p>I just tried things out on FreeBSD 12 and 13. '/dev/fd/' exists on both of them, and doing 'diff <(ls) <(ls -al)' fails with the default shell (tcsh), but works with bash (bash-5.1.8).</p>
</div>2022-01-03T17:52:49ZBy Aristotle Pagaltzis on /blog/unix/ProcessSubstitutionWhyLatetag:CSpace:blog/unix/ProcessSubstitutionWhyLate:51c84f085bf4ba1ed36073af369f67e803f27ba2Aristotle Pagaltzishttp://plasmasturm.org/<div class="wikitext"><p>When I set up FreeBSD on my home server back in 2014, I had to figure out that the reason why process substitution didn’t work wasn’t that Bash was old or didn’t have the feature on FreeBSD or was built without it or something like that, but simply because <code>/dev/fd</code> was provided by <code>fdescfs</code> and there was no entry for it in the default <code>/etc/fstab</code> – it had to be added manually.</p>
<p>I don’t know if all that is still the case.</p>
</div>2022-01-03T16:45:13Z