3 ms·
Maybe 'man <(curl -sL -H "Accept: text/roff" https://jamesg.blog/2024/02/28/programming-projects/ https://jamesg.blog/2024/02/28/programming-projects/)' works t
by penguinjanitor 3y ago
Maybe 'man <(curl -sL -H "Accept: text/roff" https://jamesg.blog/2024/02/28/programming-projects/ https://jamesg.blog/2024/02/28/programming-projects/)' works then?
- BossingAround 3y agoNope
- divbzero 3y agoThis doesn’t work because it’s equivalent to piping stdout from curl into stdin for man.
- penguinjanitor 3y agoIt's not, that would be `man <<< "$(curl ...)" `. `man <(curl ...)` is a slightly different version of the process substitution[1] from your comment - `man =(curl ...)`. [1] https://zsh.sourceforge.io/Doc/Release/Expansion.html#Process-Substitution https://zsh.sourceforge.io/Doc/Release/Expansion.html#Proces...
- divbzero 3y agoYou’re right, it isn’t quite the same as piping. man <(curl ...) ends up working on Linux but for whatever reason still yields an error on macOS: No manual entry for /dev/fd/11
- jasomill 3y agocurl -sL -H "Accept: text/roff" https://jamesg.blog/2024/02/28/programming-projects/ | mandoc -a works on macOS (and should also work on (Free|Net|Open)BSD, which ship similar man toolchains).
- globular-toast 3y agoIt's actually process substitution: https://www.gnu.org/software/bash/manual/html_node/Process-Substitution.html https://www.gnu.org/software/bash/manual/html_node/Process-S... It's essentially running the process in another shell and sending its output to a tempfile. The name of that file is then substituted in the original command. So, in theory, equivalent to `inner > /tmp/file; outer /tmp/file`. This works with programs that don't read from stdin, or need two or more inputs, for example.