Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.3: Easily view man pages with Preview' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.3: Easily view man pages with Preview
Authored by: Anidel on Nov 02, '03 06:23:56PM
Sorry, my first script was totally wrong :) This one is better, but does not test wether a man page exists or not. With a bit of more work it can do a better work in checking parameters as well as non-existence of man pages.

function pman ()
{
        if [ ! $1 ]; then
                echo "What manual page do you want!?"
                exit ;
        fi

        if [ ! $2 ]; then
                MAN_PAGE=$1;
        else
                MAN_PAGE=$2;
                MAN_SECTION=$1;
        fi;

        CACHE_PATH="$HOME/Documents/ManCache"
        CACHE_FILENAME=$CACHE_PATH/man.$MAN_SECTION.$MAN_PAGE.pdf

        if [ ! -e "$CACHE_PATH" ]; then
                mkdir -p $CACHE_PATH;
        fi

        if [ ! -e "$CACHE_FILENAME" ]; then
                man -t $@ | pstopdf -p -i -o $CACHE_FILENAME;
        fi

        open $CACHE_FILENAME;
}

Feel free to add it to your $HOME/.bash_profile or $HOME/.tcsh_login (if I remember well) scripts.

---
Anidel

[ Reply to This | # ]

10.3: Easily view man pages with Preview
Authored by: aranor on Nov 02, '03 06:40:05PM

See my reply to your previous script.



[ Reply to This | # ]