user2377245
user2377245

Reputation: 37

Using MAN command for describing Documentation of a script

I have a sample script in perl. e.g script.pl Contents: print "Hello\n";

I also have a document for the above script as script.doc which describes the script usage and other details. I want to write MAN command so that it explains the document completely. Using the document as a reference.

Please help. I am unable to find any lead on the same also I am new to UNIX.

Thanks

Upvotes: 1

Views: 97

Answers (1)

Douglas Leeder
Douglas Leeder

Reputation: 53310

You need to create a troff formatted page for the man text - as described here, then you either need an installer to put it in /usr/local/share/man (or other man directory), or else you could provide a --help option to your script that loads the man page directly.

Example page:

.\" Manpage for nuseradd.
.\" Contact [email protected] to correct errors or typos.
.TH man 8 "06 May 2010" "1.0" "nuseradd man page"
.SH NAME
nuseradd \- create a new LDAP user
.SH SYNOPSIS
nuseradd [USERNAME]
.SH DESCRIPTION
nuseradd is high level shell program for adding users to LDAP server.  On Debian, administrators should usually use nuseradd.debian(8) instead.
.SH OPTIONS
The nuseradd does not take any options. However, you can supply username.
.SH SEE ALSO
useradd(8), passwd(5), nuseradd.debian(8)
.SH BUGS
No known bugs.
.SH AUTHOR
Vivek Gite ([email protected])

Upvotes: 1

Related Questions