2012-01-05 5 views
2

sleep 스크립트라고하는 간단한 bash 스크립트가 있습니다. sleepScript에 대한 설명서/설명서를 제공하는 방법이 있습니다. 여기서 "man sleepScript"또는 "help sleepScript"명령을 입력하면 사용자 정의 설명서가 표시됩니다.사용자 정의 스크립트에 대한 사용자 정의 문서를 제공하는 방법은 무엇입니까?

+0

다음과 같습니다 아래는 (1) 사람의 매핑은 무엇입니까? 'getopts'를 사용하면'script -help' 또는'script -usage'를하고'usage' 전체를 출력 할 수 있습니다 –

답변

3

문서화하려는 내용의 맨 페이지를 작성할 수 있습니다. 간단한 스크립트의 경우 일반적으로 --help 옵션으로 충분합니다. 맨 페이지는 "roff"라고하는 이전 마크 업으로 작성됩니다. 여기에서 문서의 요약본을 볼 수 있습니다 : http://www.schweikhardt.net/man_page_howto.html

자세한 내용은 man (7)에서 찾을 수 있습니다.

보통 가장 쉬운 방법은 기존 맨 페이지를 가져 와서 템플릿으로 사용하는 것입니다. "man foo"를 입력했을 때 사용자가 맨 페이지를 볼 수있게하려면 맨 페이지를 manpath의 어딘가에 배치해야합니다. 기본적으로/usr/share/man입니다. $ MANPATH가 설정되어 있지 않으면 /etc/manpath.config에있는 디렉토리가 사용됩니다. 맨 페이지의 범주는 단일 정수 여야합니다. 당신 그래서 예를 들면

1 Executable programs or shell commands 
    2 System calls (functions provided by the kernel) 
    3 Library calls (functions within program libraries) 
    4 Special files (usually found in /dev) 
    5 File formats and conventions eg /etc/passwd 
    6 Games 
    7 Miscellaneous (including macro packages and convenâ 
     tions), e.g. man(7), groff(7) 
    8 System administration commands (usually only for root) 
    9 Kernel routines [Non standard] 

파일 가능성이 왜 사용을 인쇄 /usr/share/man/man1/sleepScript.1

관련 문제