#!/bin/bash
#                       /usr/local/bin/bash_script_man 
#  http://crystalfaeries.net/posix/bin/bash_script_man 
# celeste:crystalfaery 2016-02-24 15:49:00+00:00
# produce a section 1 man page for a local script
# argument is the basename of the script (e.g. bash_script_man)

# interactively remove the old version of the man page if it exists:
rm -i					/usr/local/share/man/man1/$(basename "$1").1

# generate the new man page:
help2man -n $(basename "$1") -s 1 -N -o /usr/local/share/man/man1/$(basename "$1").1 "`which $1`"

# view your handywork:
man $(basename $1)


syntax highlighted by Code2HTML, v. 0.9.1