如何为我的shell脚本创建手册页?
我无法找到关于如何在Google上制作手册页的初学者方法。如何为我的shell脚本创建一个手册页?
根据模板制作我自己的手册页并使用脚本进行安装的最简单方法是什么?
如何为我的shell脚本创建手册页?
我无法找到关于如何在Google上制作手册页的初学者方法。如何为我的shell脚本创建一个手册页?
根据模板制作我自己的手册页并使用脚本进行安装的最简单方法是什么?
样品手册页,从link:
.\" 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])
与脚本安装:
install -g 0 -o 0 -m 0644 nuseradd.1 /usr/local/man/man8/
gzip /usr/local/man/man8/nuseradd.1
手动安装它:关于使用pandoc
cp nuseradd /usr/local/man/man8/nuseradd.1
gzip /usr/local/man/man8/nuseradd.1
什么。您可以在markdown(甚至是html,latex)中编写文档,并且可以转换为html,pdf,word,手册页,epub,....这样您就可以用一种格式编写文档并以任何格式转换/分发你喜欢
help2man在给出--help
标志以产生一个像样的手册页时使用脚本的输出。
这需要很少的努力并提供合理的输出。由于它通过--help
和--version
时依赖于你的脚本的输出也迫使你写一个体面的--help
:-)
C1sc0您的答案中有错误。
,使自己的手册页,请按照下列步骤操作:
1成为超级用户:
$ sudo -i
2 - 到这个目录:
$ cd /usr/bin
$ nano your_function
3 - 复制粘贴这个man(maual)页面的模板,然后根据您的项目对其进行个性化设置:
./" Manpage for your_fonction
.TH man 1 "10 September 2017" "1.0" "your_fonction man page"
.SH NAME
your_fonction - do....
.SH SYNOPSIS
your_fonction [optionnal argument] [optionnal argument]
.SH DESCRIPTION
your_fonction is a function which .....
.SH OPTIONS
your_fonction does not take any options
.SH BUGS
No known bugs.
.SH AUTHOR
written by your_name (your_website or your_github or whatever)
.SH REPORTING BUGS
you_github_repository/isssues for example
4-你必须选择在哪个目录的男人你的文件必须,看:
$ cd/usr/share/man/ && ls
你看到男1,男2,.... 这些是类:
(MAN1)1 - 提供给用户命令
(MAN2)2 - 的Unix和C的系统调用
(man3)的更新3 - C库例程C程序
(男4)4 - 特殊文件名
(MAN5)5 - 文件格式和约定由Unix
(man6)6使用的文件 - 游戏
(man7)7 - 文字处理包
(man8)8 - 系统管理命令和程序
这里的例子中,目的地将是男1,所以:
5回USR/bin中
$ cd /usr/bin
6-使具有良好的后缀副本:
$ cp your_function your_function.1
7 - gzip的your_function.1
$ gzip your_function.1
8将其发送到良好的目录,这里示例man1:
$ cp your_function.1.gz /usr/share/man/man1/
这样做,你可以测试你的美丽的男人页!
$ man your_function
http://www.cyberciti.biz/faq/linux-unix-creating-a-manpage/ – C1sc0
没错,但说我需要一个特殊格式的文件,它并没有告诉我如何格式化为:/。另外我不明白如何安装它。 –