#!/bin/ksh93 typeset -r VERSION='1.0' FPROG=${.sh.file} PROG=${FPROG##*/} SDIR=${FPROG%/*} function showUsage { [[ -n $1 ]] && X='-?' || X='--man' getopts -a ${PROG} "${ print ${USAGE} ; }" OPT $X } function doMain { print "TBD (to be done)" } USAGE="[-?${VERSION}"' ] [-copyright?Copyright (c) 2015 Jens Elkner. All rights reserved.] [-license?CDDL 1.0] [+NAME?'"${PROG}"' - @short_description@.] [+DESCRIPTION? A @longer_description@.] [h:help?Print this help and exit.] [F:functions?Print a list of all functions available.] [T:trace]:[list?Comma separated \alist\a of function names of this script to trace (convinience for troubleshooting).] [+?] [f:file]:[path?Read in the given file bla bla ...] [+EXAMPLES]{ [+?'"${PROG}"' -f /tmp/zpool.events] } [+SEE ALSO?\bksh93\b(1).] \n\n[event_file] ... ' X="${ print ${USAGE} ; }" unset FILES; typeset -a FILES while getopts "${X}" OPT ; do case ${OPT} in h) showUsage ; exit 0 ;; T) if [[ ${OPTARG} == 'ALL' ]]; then typeset -ft ${ typeset +f ; } else typeset -ft ${OPTARG//,/ } fi ;; F) typeset +f && exit 0 ;; f) FILES+=( "${OPTARG}" ) ;; *) showUsage 1 ; exit 1 ;; esac done X=$((OPTIND-1)) shift $X && OPTIND=1 unset X doMain "$@"