3 ms·
Unfortunately, that command doesn't work on macOS (`/usr/bin/man: illegal option -- l`). I tried to get a one-liner with piping working on my Mac but I always r
by zerojames 3y ago
Unfortunately, that command doesn't work on macOS (`/usr/bin/man: illegal option -- l`). I tried to get a one-liner with piping working on my Mac but I always ran into errors. The -l flag doesn't exist in the macOS man implementation (I consulted the man page; meta!).
- jolmg 3y agoThe `-l` can be skipped (probably because there are `/`s in man's argument): curl -sL -H "Accept: text/roff" https://jamesg.blog/2024/02/28/programming-projects/ | man /dev/stdin
- BossingAround 3y ago(which still doesn't work on mac)
- divbzero 3y agoThis still doesn’t work for me on macOS, perhaps a difference in how /dev/stdin is implemented? Fortunately, macOS has ZSH as the default shell so the following does work: man =(curl -sL -H "Accept: text/roff" https://jamesg.blog/2024/02/28/programming-projects/)
- penguinjanitor 3y agoMaybe '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.