← Back to context

Comment by jen20

6 years ago

Absolutely - I can't buy into the "don't write man pages" idea.

For many years I've had this function in my RC files for macOS:

    pman() { man -t "$@" | open -f -a Preview; }

It opens the given man page in Preview, typeset beautifully. No such thing is available for random text printed to the console, nor is a console pager (as recommended by this article) an acceptable substitute for this.

For those on Linux you can do this with:

f=$(mktemp);man -t "$@" > "$f" && ( {some-pdf-viewer} "$f" ; rm "$f" )

... replacing '{some-pdf-viewer}' with whatever PDF viewer works for you. There is probably one that will take the document on stdin, but I am not aware of one.

I realize I'm late to the party here, but thought is was worth posting anyway. (edited for typo)