|
shellscript_template_k93 - Korn Shell Script Template -
Mt Xia: Technical Consulting Group
We have expert shell programmers currently available to assist your
organization with complex shell scripting projects. We have developed
business continuity, disaster recovery, high availability and
virtualization systems entirely in shell scripts and we have the advanced
technical skills to solve your problems as well. Please
Contact Us for more information.
#!/usr/bin/ksh93
################################################################
function usagemsg_your_function {
print "
Program: your_function
Place a brief description ( < 255 chars ) of your shell
function here.
Usage: ${1##*/} [-?vV]
Where:
-v = Verbose mode - displays your_function function info
-V = Very Verbose Mode - debug output displayed
-? = Help - display this message
Author: Your Name (YourEmail@address.com)
\"AutoContent\" enabled
"
}
################################################################
####
#### Description:
####
#### Place a full text description of your shell function here.
####
#### Assumptions:
####
#### Provide a list of assumptions your shell function makes,
#### with a description of each assumption.
####
#### Dependencies:
####
#### Provide a list of dependencies your shell function has,
#### with a description of each dependency.
####
#### Products:
####
#### Provide a list of output your shell function produces,
#### with a description of each product.
####
#### Configured Usage:
####
#### Describe how your shell function should be used.
####
#### Details:
####
#### Place nothing here, the details are your shell function.
####
################################################################
function your_function {
typeset VERSION="1.0"
typeset TRUE="1"
typeset FALSE="0"
typeset VERBOSE="${FALSE}"
typeset VERYVERB="${FALSE}"
while getopts ":vV" OPTION
do
case "${OPTION}" in
'v') VERBOSE="${TRUE}";;
'V') VERYVERB="${TRUE}";;
'?') usagemsg_your_function "${0}" && return 1 ;;
':') usagemsg_your_function "${0}" && return 1 ;;
'#') usagemsg_your_function "${0}" && return 1 ;;
esac
done
shift $(( ${OPTIND} - 1 ))
trap "usagemsg_your_function ${0}" EXIT
#### Place any command line option error checking statements
#### here. If an error is detected, print a message to
#### standard error, and return from this function with a
#### non-zero return code. The "trap" statement will cause
#### the "usagemsg" to be displayed.
trap "-" EXIT
(( VERYVERB == TRUE )) && set -x
(( VERBOSE == TRUE )) && print -u 2 "# Version........: ${VERSION}"
################################################################
####
#### Your shell function should perform it's specfic work here.
#### All work performed by your shell function should be coded
#### within this section of the function. This does not mean that
#### your function should be called from here, it means the shell
#### code that performs the work of your function should be
#### incorporated into the body of this function. This should
#### become your function.
####
return 0
}
################################################################
your_function "${@}"
|
|
|