Sometimes you are feeling down, you want to 'man up' -- how can I add this manual entry in unix?

Cris-Mac-Book-2:src cris$ man up
No manual entry for up

How can I remedy this situation?

I want to add an 'invented' manual entry for a non-existant command up so I can type man up when required. Suggestions of stuff to include are welcome additions to manual adding instructions.

Also, in case my workstation ever gets female users, I will be sure to ln woman :

Cris-Mac-Book-2:src cris$ sudo link /usr/bin/man /usr/bin/woman
Cris-Mac-Book-2:src cris$ woman
What manual page do you want?
Cris-Mac-Book-2:src cris$ 

Though I should probably change that to Which womanual page do you want? -- would that involve re-compile or is there a patch?


Solution 1:

Here seem to be good instructions for adding a new manual page:

HowTo: Linux / UNIX Create a Manpage

In short, a manpage is simply a text file, with additional formatting information for troff

Its usually in the format

.\" Manpage for up.
.\" Contact [email protected] to correct errors or typos.
.TH man 8 "06 May 2010" "1.0" "name man page"
.SH NAME
up \- into a higher position or level
.SH SYNOPSIS
up [anything you like]
.SH DESCRIPTION
up is a pretty good place to be
.SH OPTIONS
up does not take any options, though you can choose the speed of your acent 
.SH SEE ALSO
yes(1), time cat (2) cal 3() 
.SH BUGS
No known bugs. Gravity is not a bug, "Its a feature"
.SH AUTHOR
Chris Stringfellow ([email protected])

Save this as up

You can then view the manpage with man ./up from the same directory

Man pages are usually under /usr/local/man/man8/ and gzipped

You can copy over your manpage with cp up /usr/local/man/man8/up.1 then gzip it with gzip /usr/local/man/man8/name.1

You can then test it with man up - which should output something like this

Solution 2:

Though I should probably change that to Which womanual page do you want? -- would that involve re-compile or is there a patch?

Recompiling yields the best results, but this should do in the meantime:

#!/bin/bash

ARG=${1/woman/man}

man $ARG > /dev/null 2>&1

if [ $? -eq 0 ]; then
    man $ARG 2> /dev/null \
        | sed \
            -e 's/\(m[ae]n\)/wo\1/g' \
            -e 's/\(M[AE]N\)/WO\1/g' \
            -e 's/M\([ae]n\)/Wom\1/g' \
            -e 's/    //' \
            -e 's/\([^ ]\)  /\1 /g' \
        | less
else
    man $ARG 2>&1 | sed -e 's/\(m[ae]n\)/wo\1/'
fi

Save as /usr/sbin/woman, set execution permissions and start testing:

woman
woman down
woman woman