If you have Perl, here is an example of who used the Perl POD to document the shell script.
The trick is to have the Perl POD section in the bash "Here-Document" right after the null command (no-op) :.
- Start with
: <<=cut - Write your service page in POD format
- What is it. Your POD ends with
=cut, which was also defined as the end of the Here-doc shell.
Then your script can be processed with all the usual Perl tools, such as perldoc or perl2html, and you can even create real pages with pod2man.
An example is the podtest.shscript:
#!/bin/dash
echo This is a plain shell script
echo Followed by POD documentation
: <<=cut
=pod
=head1 NAME
podtest.sh - Example shell script with embedded POD documentation
...
No rights Reserved
=cut
To add this podtest.sh to your man pages:
pod2man podtest.sh >/usr/local/share/man/man1/podtest.sh.1
Steve source
share